mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 15:14:26 +00:00
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.
This commit is contained in:
parent
b9f49cee45
commit
30b9d7f00e
5 changed files with 43 additions and 3 deletions
|
@ -248,6 +248,12 @@ in
|
||||||
activationBinPaths = lib.makeBinPath [
|
activationBinPaths = lib.makeBinPath [
|
||||||
pkgs.bash
|
pkgs.bash
|
||||||
pkgs.coreutils
|
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" ''
|
sf = pkgs.writeText "activation-script" ''
|
||||||
|
|
|
@ -351,6 +351,25 @@ in
|
||||||
before that date.
|
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.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,8 @@ in
|
||||||
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
|
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
|
||||||
|
|
||||||
home.activation.createHomeInfoDir = dagEntryAfter ["installPackages"] ''
|
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 mkdir -p "${cfg.homeInfoDirLocation}"
|
||||||
$DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
|
$DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
|
||||||
if [[ -d "${homeInfoPath}" ]]; then
|
if [[ -d "${homeInfoPath}" ]]; then
|
||||||
|
@ -71,6 +73,8 @@ in
|
||||||
-exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
|
-exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
|
||||||
"${cfg.homeInfoDirLocation}/dir" \;
|
"${cfg.homeInfoDirLocation}/dir" \;
|
||||||
fi
|
fi
|
||||||
|
export PATH="$oPATH"
|
||||||
|
unset oPATH
|
||||||
'';
|
'';
|
||||||
|
|
||||||
home.packages = [ infoPkg ];
|
home.packages = [ infoPkg ];
|
||||||
|
|
|
@ -142,7 +142,7 @@ in
|
||||||
home.activation.applyPolybar = dagEntryAfter [ "reloadSystemD" ] ''
|
home.activation.applyPolybar = dagEntryAfter [ "reloadSystemD" ] ''
|
||||||
if [[ -v polybarChanged && -v DISPLAY ]]; then
|
if [[ -v polybarChanged && -v DISPLAY ]]; then
|
||||||
echo "Restarting polybar"
|
echo "Restarting polybar"
|
||||||
systemctl --user restart polybar.service
|
${config.systemd.user.systemctlPath} --user restart polybar.service
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,6 +49,17 @@ in
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
systemd.user = {
|
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 {
|
services = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.attrs;
|
type = types.attrs;
|
||||||
|
@ -157,7 +168,7 @@ in
|
||||||
local -a toRestart=( )
|
local -a toRestart=( )
|
||||||
|
|
||||||
for f in ''${maybeRestart[@]} ; do
|
for f in ''${maybeRestart[@]} ; do
|
||||||
if systemctl --quiet --user is-active "$f" \
|
if ${cfg.systemctlPath} --quiet --user is-active "$f" \
|
||||||
&& ! cmp --quiet \
|
&& ! cmp --quiet \
|
||||||
"$oldUserServicePath/$f" \
|
"$oldUserServicePath/$f" \
|
||||||
"$newUserServicePath/$f" ; then
|
"$newUserServicePath/$f" ; then
|
||||||
|
@ -187,7 +198,7 @@ in
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
$DRY_RUN_CMD systemctl --user daemon-reload
|
$DRY_RUN_CMD ${cfg.systemctlPath} --user daemon-reload
|
||||||
systemdPostReload
|
systemdPostReload
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue