1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

nixos: add nix package to activation script path

Fixes #2178
This commit is contained in:
Robert Helgesson 2021-07-19 23:07:02 +02:00
parent 41101d0e62
commit ddeeb031fd
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 25 additions and 9 deletions

View file

@ -373,6 +373,16 @@ in
description = "The package containing the complete activation script.";
};
home.extraActivationPath = mkOption {
internal = true;
type = types.listOf types.package;
default = [ ];
description = ''
Extra packages to add to <envar>PATH</envar> within the activation
script.
'';
};
home.extraBuilderCommands = mkOption {
type = types.lines;
default = "";
@ -570,15 +580,17 @@ in
# Programs that always should be available on the activation
# script's PATH.
activationBinPaths = lib.makeBinPath [
pkgs.bash
pkgs.coreutils
pkgs.diffutils # For `cmp` and `diff`.
pkgs.findutils
pkgs.gnugrep
pkgs.gnused
pkgs.ncurses # For `tput`.
]
activationBinPaths = lib.makeBinPath (
[
pkgs.bash
pkgs.coreutils
pkgs.diffutils # For `cmp` and `diff`.
pkgs.findutils
pkgs.gnugrep
pkgs.gnused
pkgs.ncurses # For `tput`.
] ++ config.home.extraActivationPath
)
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeShellScript "activation-script" ''

View file

@ -32,6 +32,10 @@ let
home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home;
# Make activation script use same version of Nix as system as a whole.
# This avoids problems with Nix not being in PATH.
home.extraActivationPath = [ config.nix.package ];
};
})
] ++ cfg.sharedModules;