Merge pull request #68483 from chkno/optional-home-bin-in-path

nixos/shells-environment: Make ~/bin/ in $PATH optional
This commit is contained in:
Andreas Rammhold 2019-11-02 14:27:24 +01:00 committed by GitHub
commit 5d5b1405a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,6 +118,14 @@ in
type = with types; attrsOf (nullOr (either str path));
};
environment.homeBinInPath = mkOption {
description = ''
Include ~/bin/ in $PATH.
'';
default = true;
type = types.bool;
};
environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh";
defaultText = "\${config.system.build.binsh}/bin/sh";
@ -186,8 +194,10 @@ in
${cfg.extraInit}
# ~/bin if it exists overrides other bin directories.
export PATH="$HOME/bin:$PATH"
${optionalString cfg.homeBinInPath ''
# ~/bin if it exists overrides other bin directories.
export PATH="$HOME/bin:$PATH"
''}
'';
system.activationScripts.binsh = stringAfter [ "stdio" ]