···7373 done
7474 '';
75757676+ /* Create a channel job which success depends on the success of all of
7777+ its contituents. Channel jobs are a special type of jobs that are
7878+ listed in the channel tab of Hydra and that can be suscribed.
7979+ A tarball of the src attribute is distributed via the channel.
8080+8181+ - constituents: a list of derivations on which the channel success depends.
8282+ - name: the channel name that will be used in the hydra interface.
8383+ - src: should point to the root folder of the nix-expressions used by the
8484+ channel, typically a folder containing a `default.nix`.
8585+8686+ channel {
8787+ constituents = [ foo bar baz ];
8888+ name = "my-channel";
8989+ src = ./.;
9090+ };
9191+9292+ */
9393+ channel =
9494+ { name, src, constituents ? [], meta ? {}, isNixOS ? true, ... }@args:
9595+ stdenv.mkDerivation ({
9696+ preferLocalBuild = true;
9797+ _hydraAggregate = true;
9898+9999+ phases = [ "unpackPhase" "patchPhase" "installPhase" ];
100100+101101+ patchPhase = stdenv.lib.optionalString isNixOS ''
102102+ touch .update-on-nixos-rebuild
103103+ '';
104104+105105+ installPhase = ''
106106+ mkdir -p $out/{tarballs,nix-support}
107107+108108+ tar cJf "$out/tarballs/nixexprs.tar.xz" \
109109+ --owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
110110+ --transform='s!^\.!${name}!' .
111111+112112+ echo "channel - $out/tarballs/nixexprs.tar.xz" > "$out/nix-support/hydra-build-products"
113113+ echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
114114+115115+ # Propagate build failures.
116116+ for i in $constituents; do
117117+ if [ -e "$i/nix-support/failed" ]; then
118118+ touch "$out/nix-support/failed"
119119+ fi
120120+ done
121121+ '';
122122+123123+ meta = meta // {
124124+ isHydraChannel = true;
125125+ };
126126+ } // removeAttrs args [ "meta" ]);
127127+76128}