mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 23:43:30 +00:00
activation-script module: add environment.usrbinenv option
This commit is contained in:
parent
e67717bc8d
commit
df82096af0
@ -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 =
|
||||
|
Loading…
Reference in New Issue
Block a user