about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-04-15 17:29:39 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-04-15 17:29:39 +0200
commit418537a3628fc6c21b3dc2949c114b1a27dd2768 (patch)
tree3f5ae493244124a71742383416f695d7395c5809 /pkgs/build-support
parenta610560bb4b5a05eb480a4dbab3e24c553727047 (diff)
pkgs: Add helper function for creating channels.
We're going to create several channels and we don't want to code
duplicates across vuizvui. This essentially not only creates a channel
but also ties it to constituents, which make sure that channels are only
updated whenever all constituent builds are successful.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/channel.nix29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/build-support/channel.nix b/pkgs/build-support/channel.nix
new file mode 100644
index 00000000..ff0fecb3
--- /dev/null
+++ b/pkgs/build-support/channel.nix
@@ -0,0 +1,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" ]