1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 23:03:53 -04:00
nix/tests/functional/shell-hello.nix

59 lines
1.1 KiB
Nix
Raw Normal View History

2017-11-20 12:36:36 -05:00
with import ./config.nix;
rec {
2017-11-20 12:36:36 -05:00
hello = mkDerivation {
name = "hello";
outputs = [ "out" "dev" ];
meta.outputsToInstall = [ "out" ];
2017-11-20 12:36:36 -05:00
buildCommand =
''
mkdir -p $out/bin $dev/bin
2017-11-20 12:36:36 -05:00
cat > $out/bin/hello <<EOF
#! ${shell}
who=\$1
echo "Hello \''${who:-World} from $out/bin/hello"
EOF
chmod +x $out/bin/hello
cat > $dev/bin/hello2 <<EOF
#! ${shell}
echo "Hello2"
EOF
chmod +x $dev/bin/hello2
2017-11-20 12:36:36 -05:00
'';
};
hello-symlink = mkDerivation {
name = "hello-symlink";
buildCommand =
''
ln -s ${hello} $out
'';
};
forbidden-symlink = mkDerivation {
name = "forbidden-symlink";
buildCommand =
''
ln -s /tmp/foo/bar $out
'';
};
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
'';
};
2017-11-20 12:36:36 -05:00
}