about summary refs log tree commit diff
path: root/release.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-04-28 09:32:48 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-04-28 09:32:48 +0200
commitc1af83e0e71c58491ca4639fa5bcf5be9d54fbb3 (patch)
tree793166b8ee616018a8aa89aaa32f13a6aec31766 /release.nix
parenta88c9fe4df49698770b01b463460a6a4fb75f07b (diff)
release.nix: Tie nixpkgs to channel tarball.
Right now, this is done by replacing all NIX_PATH references with
<nixpkgs...> by the path from Hydra input and silently hope that we
won't replace the wrong reference ;-)

Of course we're only replacing it in files that end with a .nix suffix,
so we shouldn't accidentally replace documentation.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'release.nix')
-rw-r--r--release.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/release.nix b/release.nix
index b81ca837..5ce3201f 100644
--- a/release.nix
+++ b/release.nix
@@ -1,4 +1,5 @@
 { vuizvui ? { outPath = ./.; revCount = 12345; shortRev = "abcdefg"; }
+, nixpkgs ? { outPath = <nixpkgs>; revCount = 12345; shortRev = "abcdefg"; }
 , supportedSystems ? [ "i686-linux" "x86_64-linux" ]
 }:
 
@@ -7,6 +8,19 @@ let
   pkgsUpstream = import <nixpkgs> { inherit system; };
   root = import ./default.nix { inherit system; };
 
+  patchNixpkgsReference = path: ''
+    find -iname '*.nix' -type f -exec \
+      sed -i -re 's!<nixpkgs([^>]*)>!${path}\1!g' {} +
+  '';
+
+  patchedNixpkgs = pkgsUpstream.stdenv.mkDerivation rec {
+    name = "nixpkgs-${version}";
+    version = "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
+    phases = [ "unpackPhase" "patchPhase" "installPhase" ];
+    installPhase = "cp -r . \"$out\"";
+    patchPhase = patchNixpkgsReference "'\"$out\"'";
+  };
+
 in with pkgsUpstream.lib; with builtins; {
 
   machines = mapAttrsRecursiveCond (m: !(m ? build)) (path: attrs:
@@ -29,6 +43,7 @@ in with pkgsUpstream.lib; with builtins; {
       name = "vuizvui-channel-${attrs.name or "generic"}-${version}";
       version = "${toString vuizvui.revCount}.${vuizvui.shortRev}";
       src = vuizvui;
+      patchPhase = patchNixpkgsReference patchedNixpkgs;
     } // removeAttrs attrs [ "name" ]);
 
   in {