about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2016-01-22 11:18:37 +0100
committerPeter Simons <simons@cryp.to>2016-01-22 11:18:37 +0100
commit9ee5a6b858722b2d25e3054faed2b3d35c507f8b (patch)
tree11f9476b011fe26b520e9146cd65c25cb11a79ab /nixos/modules/system
parentb7fbb5362a9eca4e9aa52d397b5550a23d0d7dc7 (diff)
parentdf82096af06deaa8ddd53accaaa488474575b6d6 (diff)
downloadnixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar.gz
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar.bz2
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar.lz
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar.xz
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.tar.zst
nixlib-9ee5a6b858722b2d25e3054faed2b3d35c507f8b.zip
Merge pull request #12481 from nathan7/usrbinenv-option
activation-script module: add environment.usrbinenv option
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/activation/activation-script.nix22
1 files changed, 19 insertions, 3 deletions
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 02b3e25a313d..d78ec0d7bf3d 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -94,6 +94,18 @@ in
 
     };
 
+    environment.usrbinenv = mkOption {
+      default = "${pkgs.coreutils}/bin/env";
+      example = literalExample ''
+        "''${pkgs.busybox}/bin/env"
+      '';
+      type = types.nullOr types.path;
+      visible = false;
+      description = ''
+        The env(1) executable that is linked system-wide to
+        <literal>/usr/bin/env</literal>.
+      '';
+    };
   };
 
 
@@ -128,11 +140,15 @@ in
         mkdir -m 0555 -p /var/empty
       '';
 
-    system.activationScripts.usrbinenv =
-      ''
+    system.activationScripts.usrbinenv = if config.environment.usrbinenv != null
+      then ''
         mkdir -m 0755 -p /usr/bin
-        ln -sfn ${pkgs.coreutils}/bin/env /usr/bin/.env.tmp
+        ln -sfn ${config.environment.usrbinenv} /usr/bin/.env.tmp
         mv /usr/bin/.env.tmp /usr/bin/env # atomically replace /usr/bin/env
+      ''
+      else ''
+        rm -f /usr/bin/env
+        rmdir --ignore-fail-on-non-empty /usr/bin /usr
       '';
 
     system.activationScripts.tmpfs =