git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #12481 from nathan7/usrbinenv-option

activation-script module: add environment.usrbinenv option

commit9ee5a6b858722b2d25e3054faed2b3d35c507f8b authorPeter Simons <simons@cryp.to> dateFri 22 Jan 2016, 11:18 (11 years ago) parentb7fbb53df82096
1 file changed+19−3
nixos/modules/system/activation/activation-script.nix+19−3
nixos/modules/system/activation/activation-script.nix+19−3
@@ -94,6 +94,18 @@ in
9494
9595 };
9696
97+ environment.usrbinenv = mkOption {
98+ default = "${pkgs.coreutils}/bin/env";
99+ example = literalExample ''
100+ "''${pkgs.busybox}/bin/env"
101+ '';
102+ type = types.nullOr types.path;
103+ visible = false;
104+ description = ''
105+ The env(1) executable that is linked system-wide to
106+ <literal>/usr/bin/env</literal>.
107+ '';
108+ };
97109 };
98110
99111
@@ -128,11 +140,15 @@ in
128140 mkdir -m 0555 -p /var/empty
129141 '';
130142
131− system.activationScripts.usrbinenv =
132− ''
143+ system.activationScripts.usrbinenv = if config.environment.usrbinenv != null
144+ then ''
133145 mkdir -m 0755 -p /usr/bin
134− ln -sfn ${pkgs.coreutils}/bin/env /usr/bin/.env.tmp
146+ ln -sfn ${config.environment.usrbinenv} /usr/bin/.env.tmp
135147 mv /usr/bin/.env.tmp /usr/bin/env # atomically replace /usr/bin/env
148+ ''
149+ else ''
150+ rm -f /usr/bin/env
151+ rmdir --ignore-fail-on-non-empty /usr/bin /usr
136152 '';
137153
138154 system.activationScripts.tmpfs =