diff --git a/hosts/common/programs/pipewire.nix b/hosts/common/programs/pipewire.nix index 81f4010d..42329dbf 100644 --- a/hosts/common/programs/pipewire.nix +++ b/hosts/common/programs/pipewire.nix @@ -42,10 +42,10 @@ in mkdir -p $PIPEWIRE_RUNTIME_DIR exec pipewire ''; - readiness.waitCommand = pkgs.writeShellScript "pipewire-wait-started" '' - test -e "$PIPEWIRE_RUNTIME_DIR/pipewire-0" && \ - test -e "$PIPEWIRE_RUNTIME_DIR/pipewire-0-manager" - ''; + readiness.waitExists = [ + "$PIPEWIRE_RUNTIME_DIR/pipewire-0" + "$PIPEWIRE_RUNTIME_DIR/pipewire-0-manager" + ]; cleanupCommand = ''rm -f "$PIPEWIRE_RUNTIME_DIR/{pipewire-0,pipewire-0.lock,pipewire-0-manager,pipewire-0-manager.lock}"''; }; services.pipewire-pulse = { @@ -53,10 +53,10 @@ in depends = [ "pipewire" ]; partOf = [ "sound" ]; command = "pipewire-pulse"; - readiness.waitCommand = pkgs.writeShellScript "pipewire-pulse-wait-started" '' - test -e "$XDG_RUNTIME_DIR/pulse/native" && \ - test -e "$XDG_RUNTIME_DIR/pulse/pid" - ''; + readiness.waitExists = [ + "$XDG_RUNTIME_DIR/pulse/native" + "$XDG_RUNTIME_DIR/pulse/pid" + ]; cleanupCommand = ''rm -f "$XDG_RUNTIME_DIR/pulse/{native,pid}"''; }; }; diff --git a/hosts/common/programs/sway/default.nix b/hosts/common/programs/sway/default.nix index cbd743b8..0ea56e22 100644 --- a/hosts/common/programs/sway/default.nix +++ b/hosts/common/programs/sway/default.nix @@ -230,10 +230,7 @@ in mkdir -p /tmp/.X11-unix # for Xwayland exec sway ''; - # readiness.waitExists = "$SWAYSOCK"; - readiness.waitCommand = pkgs.writeShellScript "sway-readycheck" '' - test -e "$SWAYSOCK" && test -e "$WAYLAND_DISPLAY" - ''; + readiness.waitExists = [ "$SWAYSOCK" "$WAYLAND_DISPLAY" ]; }; # link the graphical-session into the default target, so sway gets auto-started services.graphical-session.partOf = [ "default" ]; diff --git a/modules/users/default.nix b/modules/users/default.nix index dc424792..aae1d3aa 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -67,8 +67,8 @@ let ''; }; readiness.waitExists = mkOption { - type = types.nullOr types.str; - default = null; + type = types.coercedTo types.str toList (types.listOf types.str); + default = []; description = '' path to a directory or file whose existence signals the service's readiness. this is expanded as a shell expression, and may contain variables like `$HOME`, etc. @@ -80,8 +80,9 @@ let (lib.mkIf (config.readiness.waitDbus != null) ''${pkgs.systemdMinimal}/bin/busctl --user status "${config.readiness.waitDbus}" > /dev/null'' ) - (lib.mkIf (config.readiness.waitExists != null) - ''test -e "${config.readiness.waitExists}"'' + (lib.mkIf (config.readiness.waitExists != []) + # e.g.: test -e /foo -a -e /bar + ("test -e " + (lib.concatStringsSep " -a -e " config.readiness.waitExists)) ) ]; };