1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-20 10:09:45 +01:00

imapnotify: use direct nix store path for config

As pointed out in #3291, using the XDG symlink means the agent/unit
files don’t change when the contents of the config changes, and so the
service will not be restarted.
This commit is contained in:
David Baynard 2023-07-07 23:08:00 +01:00 committed by Robert Helgesson
parent 86157256d2
commit fad475553a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 9 additions and 11 deletions

View file

@ -21,10 +21,9 @@ let
Unit = { Description = "imapnotify for ${name}"; }; Unit = { Description = "imapnotify for ${name}"; };
Service = { Service = {
# Use the nix store path for config to ensure service restarts when it changes
ExecStart = ExecStart =
"${getExe cfg.package} -conf '${config.xdg.configHome}/imapnotify/${ "${getExe cfg.package} -conf '${genAccountConfig account}'";
configName account
}'";
Restart = "always"; Restart = "always";
RestartSec = 30; RestartSec = 30;
Type = "simple"; Type = "simple";
@ -44,11 +43,9 @@ let
value = { value = {
enable = true; enable = true;
config = { config = {
ProgramArguments = [ # Use the nix store path for config to ensure service restarts when it changes
"${getExe cfg.package}" ProgramArguments =
"-conf" [ "${getExe cfg.package}" "-conf" "${genAccountConfig account}" ];
"${config.xdg.configHome}/imapnotify/${configName account}"
];
KeepAlive = true; KeepAlive = true;
ThrottleInterval = 30; ThrottleInterval = 30;
ExitTimeOut = 0; ExitTimeOut = 0;

View file

@ -33,8 +33,9 @@ with lib;
nmt.script = let nmt.script = let
serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist"; serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist";
in '' in ''
serviceFile=LaunchAgents/${serviceFileName} serviceFile="LaunchAgents/${serviceFileName}"
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile assertFileExists $serviceFile
assertFileContent $serviceFile ${./launchd.plist} assertFileContent $serviceFileNormalized ${./launchd.plist}
''; '';
} }

View file

@ -19,7 +19,7 @@
<array> <array>
<string>@goimapnotify@/bin/goimapnotify</string> <string>@goimapnotify@/bin/goimapnotify</string>
<string>-conf</string> <string>-conf</string>
<string>/home/hm-user/.config/imapnotify/imapnotify-hm-example.com-config.json</string> <string>/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json</string>
</array> </array>
<key>RunAtLoad</key> <key>RunAtLoad</key>
<true/> <true/>