diff options
author | Robert Helgesson <robert@rycee.net> | 2017-01-08 22:06:53 +0100 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2017-01-15 23:41:20 +0100 |
commit | 43fd747ba7c5fd9e92bfa02a32448fbb73c81113 (patch) | |
tree | 749f60ea71bc3619e64917dbc855f9e7cc6deb12 /modules/systemd.nix | |
parent | 671805009cde0cea186318724ef97397ed4b0b76 (diff) |
Use a generation directory
Before we put only user files in the generation directory but that was
quite limiting. In particular, we lost track of the activation script.
Diffstat (limited to '')
-rw-r--r-- | modules/systemd.nix | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/systemd.nix b/modules/systemd.nix index b927b04add4..5e7cc6b4390 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -64,13 +64,15 @@ in home.activation.reloadSystemD = stringAfter ["linkages"] '' function systemdPostReload() { local servicesDiffFile="$(mktemp)" + local oldUserServicePath="$oldGenPath/home-files/.config/systemd/user" + local newUserServicePath="$newGenPath/home-files/.config/systemd/user" diff \ --new-line-format='+%L' \ --old-line-format='-%L' \ --unchanged-line-format=' %L' \ - <(basename -a $(echo "$oldGenPath/.config/systemd/user/*.service") | sort) \ - <(basename -a $(echo "$newGenPath/.config/systemd/user/*.service") | sort) \ + <(basename -a $(echo "$oldUserServicePath/*.service") | sort) \ + <(basename -a $(echo "$newUserServicePath/*.service") | sort) \ > $servicesDiffFile local -a maybeRestart=( $(grep '^ ' $servicesDiffFile | cut -c2-) ) @@ -81,8 +83,8 @@ in for f in ''${maybeRestart[@]} ; do if systemctl --quiet --user is-active "$f" \ && ! cmp --quiet \ - "$oldGenPath/.config/systemd/user/$f" \ - "$newGenPath/.config/systemd/user/$f" ; then + "$oldUserServicePath/$f" \ + "$newUserServicePath/$f" ; then echo "Adding '$f' to restart list"; toRestart+=("$f") fi @@ -90,7 +92,7 @@ in rm $servicesDiffFile - sugg="" + local sugg="" if [[ -n "''${toRestart[@]}" ]] ; then sugg="$sugg\nsystemctl --user restart ''${toRestart[@]}" @@ -110,10 +112,8 @@ in fi } - if [[ "$oldGenPath" != "$newGenPath" ]] ; then - systemctl --user daemon-reload - systemdPostReload - fi + systemctl --user daemon-reload + systemdPostReload ''; }; } |