summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2019-09-10 23:00:58 -0700
committerChuck <chuck@intelligence.org>2019-09-12 06:35:37 -0700
commitb6c97cadc2e850d054a56eee6c714bd31fffd0e1 (patch)
treeed466e025c350e72cf037bca5b1dcb1e1547908b /nixos
parentb425012fdf450e7b3397d5a3d28d6091de24546f (diff)
downloadnixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar.gz
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar.bz2
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar.lz
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar.xz
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.tar.zst
nixpkgs-b6c97cadc2e850d054a56eee6c714bd31fffd0e1.zip
nixos/shells-environment: Make ~/bin/ in $PATH optional
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/shells-environment.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 9dfc1add829..ba89784033e 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -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";
@@ -184,8 +192,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" ]