aboutsummaryrefslogtreecommitdiff
path: root/modules/systemd.nix
diff options
context:
space:
mode:
authorRobert Helgesson <robert@rycee.net>2017-10-20 14:02:05 +0200
committerRobert Helgesson <robert@rycee.net>2017-10-20 19:04:33 +0200
commit30b9d7f00ee5fb3a443682f0db3a17e12ab8ee59 (patch)
tree72a3342a3e0ee4f63347edec7b8280589afb6a60 /modules/systemd.nix
parentb9f49cee45c1fce22244ab5ff7819f07d785dac3 (diff)
Use only tools from Nixpkgs in activation script
Note, we still pull in the user's `PATH` in case the user has defined their own activation blocks that depend on additional tools. Eventually this will be deprecated and removed. See #99.
Diffstat (limited to 'modules/systemd.nix')
-rw-r--r--modules/systemd.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/modules/systemd.nix b/modules/systemd.nix
index d77c0076ad9..066304773f8 100644
--- a/modules/systemd.nix
+++ b/modules/systemd.nix
@@ -49,6 +49,17 @@ in
options = {
systemd.user = {
+ systemctlPath = mkOption {
+ default = "${pkgs.systemd}/bin/systemctl";
+ defaultText = "\${pkgs.systemd}/bin/systemctl";
+ type = types.str;
+ description = ''
+ Absolute path to the <command>systemctl</command> tool. This
+ option may need to be set if running Home Manager on a
+ non-NixOS distribution.
+ '';
+ };
+
services = mkOption {
default = {};
type = types.attrs;
@@ -157,7 +168,7 @@ in
local -a toRestart=( )
for f in ''${maybeRestart[@]} ; do
- if systemctl --quiet --user is-active "$f" \
+ if ${cfg.systemctlPath} --quiet --user is-active "$f" \
&& ! cmp --quiet \
"$oldUserServicePath/$f" \
"$newUserServicePath/$f" ; then
@@ -187,7 +198,7 @@ in
fi
}
- $DRY_RUN_CMD systemctl --user daemon-reload
+ $DRY_RUN_CMD ${cfg.systemctlPath} --user daemon-reload
systemdPostReload
'';
})