summary refs log tree commit diff
path: root/pkgs/build-support/release
diff options
context:
space:
mode:
authorEric Sagnes <eric.sagnes@gmail.com>2016-08-10 15:43:35 +0900
committerEric Sagnes <eric.sagnes@gmail.com>2016-09-27 08:51:28 +0900
commit37f0aafc56c3357213833c43edc45c33e71a0f15 (patch)
treeb0fd8d55bab27889c8e4313cfa216c31e37799e2 /pkgs/build-support/release
parent199f5a2844cb31be96872599d8db7105b572f116 (diff)
downloadnixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar.gz
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar.bz2
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar.lz
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar.xz
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.tar.zst
nixpkgs-37f0aafc56c3357213833c43edc45c33e71a0f15.zip
releaseTools: add channel function
Diffstat (limited to 'pkgs/build-support/release')
-rw-r--r--pkgs/build-support/release/default.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 82919cf819f..5e3eb751b81 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -73,4 +73,56 @@ rec {
         done
       '';
 
+  /* Create a channel job which success depends on the success of all of
+     its contituents. Channel jobs are a special type of jobs that are
+     listed in the channel tab of Hydra and that can be suscribed.
+     A tarball of the src attribute is distributed via the channel.
+     
+     - constituents: a list of derivations on which the channel success depends.
+     - name: the channel name that will be used in the hydra interface.
+     - src: should point to the root folder of the nix-expressions used by the
+            channel, typically a folder containing a `default.nix`.
+
+       channel {
+         constituents = [ foo bar baz ];
+         name = "my-channel";
+         src = ./.;
+       };
+     
+  */
+  channel =
+    { name, src, constituents ? [], meta ? {}, isNixOS ? true, ... }@args:
+    stdenv.mkDerivation ({
+      preferLocalBuild = true;
+      _hydraAggregate = true;
+
+      phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+
+      patchPhase = stdenv.lib.optionalString isNixOS ''
+        touch .update-on-nixos-rebuild
+      '';
+
+      installPhase = ''
+        mkdir -p $out/{tarballs,nix-support}
+
+        tar cJf "$out/tarballs/nixexprs.tar.xz" \
+          --owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
+          --transform='s!^\.!${name}!' .
+
+        echo "channel - $out/tarballs/nixexprs.tar.xz" > "$out/nix-support/hydra-build-products"
+        echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
+
+        # Propagate build failures.
+        for i in $constituents; do
+          if [ -e "$i/nix-support/failed" ]; then
+            touch "$out/nix-support/failed"
+          fi
+        done
+      '';
+
+      meta = meta // {
+        isHydraChannel = true;
+      };
+    } // removeAttrs args [ "meta" ]);
+
 }