diff --git a/modules/users/default.nix b/modules/users/default.nix index 477cdd4a..4753f14a 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -66,12 +66,24 @@ let only once the name is registered will the service be considered "ready". ''; }; + readiness.waitExists = mkOption { + type = types.nullOr types.str; + default = null; + 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. + ''; + }; }; config = { - readiness.waitCommand = lib.mkIf - (config.readiness.waitDbus != null) - ''${pkgs.systemdMinimal}/bin/busctl --user status "${config.readiness.waitDbus}" > /dev/null'' - ; + readiness.waitCommand = lib.mkMerge [ + (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}'' + ) + ]; }; }); userOptions = {