aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/shell-hello.nix
blob: dfe66ef93c8b89a5356c0cfd779c69b8b045ffeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
with import ./config.nix;

{
  hello = mkDerivation {
    name = "hello";
    outputs = [ "out" "dev" ];
    meta.outputsToInstall = [ "out" ];
    buildCommand =
      ''
        mkdir -p $out/bin $dev/bin

        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
      '';
  };

  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
      '';
  };
}