From c1af83e0e71c58491ca4639fa5bcf5be9d54fbb3 Mon Sep 17 00:00:00 2001 From: aszlig Date: Tue, 28 Apr 2015 09:32:48 +0200 Subject: release.nix: Tie nixpkgs to channel tarball. Right now, this is done by replacing all NIX_PATH references with 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 --- release.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'release.nix') 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 = ; revCount = 12345; shortRev = "abcdefg"; } , supportedSystems ? [ "i686-linux" "x86_64-linux" ] }: @@ -7,6 +8,19 @@ let pkgsUpstream = import { inherit system; }; root = import ./default.nix { inherit system; }; + patchNixpkgsReference = path: '' + find -iname '*.nix' -type f -exec \ + sed -i -re 's!]*)>!${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 { -- cgit 1.4.1