ConditionPathExists can't use env vars.

Use a separate watch job instead.
This commit is contained in:
niten 2023-09-26 13:13:22 -07:00
parent 9a97eb1de7
commit a52626e237
1 changed files with 32 additions and 19 deletions

View File

@ -53,7 +53,20 @@ in {
config = mkIf cfg.enable {
nixpkgs.overlays = [ wallfly-overlay ];
systemd.user.services.wallfly = {
systemd.user.services = {
wallfly-password-watcher = {
requiredBy = [ "wallfly.service" ];
before = [ "wallfly.service" ];
restartIfChanged = true;
serviceConfig = {
TimeoutStartSec = 180;
ExecStart = pkgs.writeShellScript "watch-wallfly-passwd.sh" ''
test -f ${cfg.mqtt.password-file} && sleep 3
exit 0
'';
};
};
wallfly = {
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
requires = [ "graphical-session.target" ];
@ -72,7 +85,7 @@ in {
Restart = "always";
StandardOutput = "journal";
};
unitConfig.ConditionPathExists = [ cfg.mqtt.password-file ];
};
};
};
}