Merge pull request #128271 from Kreyren/localBinInPath

This commit is contained in:
Ben Siraphob 2021-07-02 22:17:44 +07:00 committed by GitHub
commit 28acaac96f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -126,6 +126,14 @@ in
type = types.bool;
};
environment.localBinInPath = mkOption {
description = ''
Add ~/.local/bin/ to $PATH
'';
default = false;
type = types.bool;
};
environment.binsh = mkOption {
default = "${config.system.build.binsh}/bin/sh";
defaultText = "\${config.system.build.binsh}/bin/sh";
@ -198,6 +206,10 @@ in
# ~/bin if it exists overrides other bin directories.
export PATH="$HOME/bin:$PATH"
''}
${optionalString cfg.localBinInPath ''
export PATH="$HOME/.local/bin:$PATH"
''}
'';
system.activationScripts.binsh = stringAfter [ "stdio" ]