1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-15 13:31:05 +01:00

tests/run.sh: Check that env is mostly unmodified

This commit is contained in:
Robert Hensing 2024-06-10 11:39:06 +02:00
parent e0b4691754
commit 68b8a28bc4
2 changed files with 43 additions and 0 deletions

View file

@ -55,4 +55,26 @@ rec {
chmod +x $out/bin/hello
'';
};
# execs env from PATH, so that we can probe the environment
# does not allow arguments, because we don't need them
env = mkDerivation {
name = "env";
outputs = [ "out" ];
buildCommand =
''
mkdir -p $out/bin
cat > $out/bin/env <<EOF
#! ${shell}
if [ $# -ne 0 ]; then
echo "env: Unexpected arguments ($#): $@" 1>&2
exit 1
fi
exec env
EOF
chmod +x $out/bin/env
'';
};
}