1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00: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."; 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 { home.extraBuilderCommands = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@ -570,15 +580,17 @@ in
# Programs that always should be available on the activation # Programs that always should be available on the activation
# script's PATH. # script's PATH.
activationBinPaths = lib.makeBinPath [ activationBinPaths = lib.makeBinPath (
pkgs.bash [
pkgs.coreutils pkgs.bash
pkgs.diffutils # For `cmp` and `diff`. pkgs.coreutils
pkgs.findutils pkgs.diffutils # For `cmp` and `diff`.
pkgs.gnugrep pkgs.findutils
pkgs.gnused pkgs.gnugrep
pkgs.ncurses # For `tput`. pkgs.gnused
] pkgs.ncurses # For `tput`.
] ++ config.home.extraActivationPath
)
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeShellScript "activation-script" '' activationScript = pkgs.writeShellScript "activation-script" ''

View file

@ -32,6 +32,10 @@ let
home.username = config.users.users.${name}.name; home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home; 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; ] ++ cfg.sharedModules;