1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19: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:
Jordan Williams 2024-11-12 14:13:32 -06:00 committed by Robert Helgesson
parent 4d8d8c385e
commit a9953635d7
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
2 changed files with 24 additions and 1 deletions

View file

@ -126,6 +126,8 @@ in {
Description = "mopidy music player daemon";
Documentation = [ "https://mopidy.com/" ];
After = [ "network.target" "sound.target" ];
X-Restart-Triggers = mkIf (cfg.settings != { })
[ "${config.xdg.configFile."mopidy/mopidy.conf".source}" ];
};
Service = {

View file

@ -29,7 +29,28 @@
};
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
assertFileExists home-files/.config/mopidy/mopidy.conf