about summary refs log tree commit diff
path: root/pkgs/build-support/channel.nix
blob: ff0fecb326ba02da07508cf1a4eebf7ccef0a8b8 (plain) (blame)
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
{ stdenv }:

{ name, channelName ? null, src, constituents ? [], meta ? {}, ... }@args:

stdenv.mkDerivation {
  inherit name channelName src constituents meta;
  _hydraAggregate = true;

  phases = [ "unpackPhase" "installPhase" ];
  installPhase = ''
    mkdir -p "$out/tarballs" "$out/nix-support"

    tar cJf "$out/tarballs/nixexprs.tar.xz" \
      --owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
      --transform='s!^\.!${name}!' .
    if [ -z "$channelName" ]; then
      echo "file channel $out/tarballs/nixexprs.tar.xz"
    else
      echo "file channel \"$channelName\" $out/tarballs/nixexprs.tar.xz"
    fi > "$out/nix-support/hydra-build-products"

    echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
    for i in $constituents; do
      if [ -e "$i/nix-support/failed" ]; then
        touch "$out/nix-support/failed"
      fi
    done
  '';
} // removeAttrs args [ "name" "channelName" "src" "constituents" "meta" ]