modules/users: allow `readiness.pathExists`

This commit is contained in:
Colin 2024-03-23 13:02:47 +00:00
parent 36ea5b53ad
commit 8008fd35cb
1 changed files with 16 additions and 4 deletions

View File

@ -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 = {