mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
mopidy: restart service on config changes
Also extend basic configuration test a bit to verify the restart trigger.
This commit is contained in:
parent
4d8d8c385e
commit
a9953635d7
2 changed files with 24 additions and 1 deletions
|
@ -126,6 +126,8 @@ in {
|
||||||
Description = "mopidy music player daemon";
|
Description = "mopidy music player daemon";
|
||||||
Documentation = [ "https://mopidy.com/" ];
|
Documentation = [ "https://mopidy.com/" ];
|
||||||
After = [ "network.target" "sound.target" ];
|
After = [ "network.target" "sound.target" ];
|
||||||
|
X-Restart-Triggers = mkIf (cfg.settings != { })
|
||||||
|
[ "${config.xdg.configFile."mopidy/mopidy.conf".source}" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
|
|
|
@ -29,7 +29,28 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = ''
|
||||||
assertFileExists home-files/.config/systemd/user/mopidy.service
|
serviceFile=home-files/.config/systemd/user/mopidy.service
|
||||||
|
assertFileExists $serviceFile
|
||||||
|
serviceFile=$(normalizeStorePaths $serviceFile)
|
||||||
|
assertFileContent $serviceFile \
|
||||||
|
${
|
||||||
|
builtins.toFile "expected-mopidy.service" ''
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/nix/store/00000000000000000000000000000000-mopidy-with-extensions/bin/mopidy --config /home/hm-user/.config/mopidy/mopidy.conf
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
After=network.target
|
||||||
|
After=sound.target
|
||||||
|
Description=mopidy music player daemon
|
||||||
|
Documentation=https://mopidy.com/
|
||||||
|
X-Restart-Triggers=/nix/store/00000000000000000000000000000000-mopidy-hm-user
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
assertPathNotExists home-files/.config/systemd/user/mopidy-scan.service
|
assertPathNotExists home-files/.config/systemd/user/mopidy-scan.service
|
||||||
|
|
||||||
assertFileExists home-files/.config/mopidy/mopidy.conf
|
assertFileExists home-files/.config/mopidy/mopidy.conf
|
||||||
|
|
Loading…
Reference in a new issue