2024-11-01 13:56:50 +00:00
|
|
|
with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix";
|
2017-11-20 17:36:36 +00:00
|
|
|
|
2024-04-10 21:46:19 +00:00
|
|
|
rec {
|
2017-11-20 17:36:36 +00:00
|
|
|
hello = mkDerivation {
|
|
|
|
name = "hello";
|
2022-04-22 13:17:01 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
meta.outputsToInstall = [ "out" ];
|
2017-11-20 17:36:36 +00:00
|
|
|
buildCommand =
|
|
|
|
''
|
2022-04-22 13:17:01 +00:00
|
|
|
mkdir -p $out/bin $dev/bin
|
|
|
|
|
2017-11-20 17:36:36 +00:00
|
|
|
cat > $out/bin/hello <<EOF
|
|
|
|
#! ${shell}
|
|
|
|
who=\$1
|
|
|
|
echo "Hello \''${who:-World} from $out/bin/hello"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/hello
|
2022-04-22 13:17:01 +00:00
|
|
|
|
|
|
|
cat > $dev/bin/hello2 <<EOF
|
|
|
|
#! ${shell}
|
|
|
|
echo "Hello2"
|
|
|
|
EOF
|
|
|
|
chmod +x $dev/bin/hello2
|
2017-11-20 17:36:36 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-12-20 18:25:22 +00:00
|
|
|
|
2024-04-10 21:46:19 +00:00
|
|
|
hello-symlink = mkDerivation {
|
|
|
|
name = "hello-symlink";
|
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
ln -s ${hello} $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-04-11 07:04:26 +00:00
|
|
|
forbidden-symlink = mkDerivation {
|
|
|
|
name = "forbidden-symlink";
|
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
ln -s /tmp/foo/bar $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-12-20 18:25:22 +00:00
|
|
|
salve-mundi = mkDerivation {
|
|
|
|
name = "salve-mundi";
|
|
|
|
outputs = [ "out" ];
|
|
|
|
meta.outputsToInstall = [ "out" ];
|
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
|
|
|
cat > $out/bin/hello <<EOF
|
|
|
|
#! ${shell}
|
|
|
|
echo "Salve Mundi from $out/bin/hello"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/hello
|
|
|
|
'';
|
|
|
|
};
|
2024-06-10 09:39:06 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2017-11-20 17:36:36 +00:00
|
|
|
}
|