aboutsummaryrefslogtreecommitdiff
path: root/modules
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
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')
-rw-r--r--modules/home-environment.nix6
-rw-r--r--modules/misc/news.nix19
-rw-r--r--modules/programs/info.nix4
-rw-r--r--modules/services/polybar.nix2
-rw-r--r--modules/systemd.nix15
5 files changed, 43 insertions, 3 deletions
diff --git a/modules/home-environment.nix b/modules/home-environment.nix
index 1ea6988137b..da0cc68e9b9 100644
--- a/modules/home-environment.nix
+++ b/modules/home-environment.nix
@@ -248,6 +248,12 @@ in
activationBinPaths = lib.makeBinPath [
pkgs.bash
pkgs.coreutils
+ pkgs.diffutils # For `cmp` and `diff`.
+ pkgs.findutils
+ pkgs.gnugrep
+ pkgs.gnused
+ pkgs.ncurses # For `tput`.
+ pkgs.nix
];
sf = pkgs.writeText "activation-script" ''
diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index 0c899ad600e..f14248ecb87 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -351,6 +351,25 @@ in
before that date.
'';
}
+
+ {
+ time = "2017-10-20T12:15:27+00:00";
+ condition = with config.systemd.user;
+ services != {} || sockets != {} || targets != {} || timers != {};
+ message = ''
+ Home Manager's interaction with systemd is now done using
+ 'systemctl' from Nixpkgs, not the 'systemctl' in '$PATH'.
+
+ If you are using a distribution whose systemd is
+ incompatible with the version in Nixpkgs then you can
+ override this behavior by adding
+
+ systemd.user.systemctlPath = "/usr/bin/systemctl"
+
+ to your configuration. Home Manager will then use your
+ chosen version.
+ '';
+ }
];
};
}
diff --git a/modules/programs/info.nix b/modules/programs/info.nix
index c3b4b5942e7..5f75ec927a2 100644
--- a/modules/programs/info.nix
+++ b/modules/programs/info.nix
@@ -64,6 +64,8 @@ in
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
home.activation.createHomeInfoDir = dagEntryAfter ["installPackages"] ''
+ oPATH=$PATH
+ export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH"
$DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}"
$DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
if [[ -d "${homeInfoPath}" ]]; then
@@ -71,6 +73,8 @@ in
-exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
"${cfg.homeInfoDirLocation}/dir" \;
fi
+ export PATH="$oPATH"
+ unset oPATH
'';
home.packages = [ infoPkg ];
diff --git a/modules/services/polybar.nix b/modules/services/polybar.nix
index 351626f8bb8..8e92b4afffa 100644
--- a/modules/services/polybar.nix
+++ b/modules/services/polybar.nix
@@ -142,7 +142,7 @@ in
home.activation.applyPolybar = dagEntryAfter [ "reloadSystemD" ] ''
if [[ -v polybarChanged && -v DISPLAY ]]; then
echo "Restarting polybar"
- systemctl --user restart polybar.service
+ ${config.systemd.user.systemctlPath} --user restart polybar.service
fi
'';
};
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
'';
})