From 29f2e5a8680176ce3407285ce1af702196e6ebb0 Mon Sep 17 00:00:00 2001 From: aszlig Date: Wed, 29 Apr 2015 06:36:04 +0200 Subject: release.nix: Refactor to use patched nixpkgs. We now use nixpkgsSrc to make sure that Hydra builds will fail as soon as we hit a reference of in either vuizvui of nixpkgs. This also means, that we don't rewrite all of vuizvui and nixpkgs anymore and we only really need to rewrite nixos-rebuild.sh. Although we're using patched nixpkgs for Hydra builds, the release.nix still has a fallback to to make development easier (patching nixpkgs on every tiny change will take a long time otherwise). Signed-off-by: aszlig --- release.nix | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'release.nix') diff --git a/release.nix b/release.nix index 5e40ea59..288dfd76 100644 --- a/release.nix +++ b/release.nix @@ -1,15 +1,24 @@ -{ vuizvui ? { outPath = ./.; - revCount = 12345; - shortRev = "abcdefg"; - } -, nixpkgs ? { outPath = import ./nixpkgs-path.nix; - revCount = 12345; - shortRev = "abcdefg"; - } +{ vuizvui ? { outPath = ./.; revCount = 12345; shortRev = "abcdefg"; } +, nixpkgsSrc ? null , supportedSystems ? [ "i686-linux" "x86_64-linux" ] }: let + nixpkgsRevCount = nixpkgsSrc.revCount or 12345; + nixpkgsShortRev = nixpkgsSrc.shortRev or "abcdefg"; + + nixpkgs = let + patchedNixpkgs = (import nixpkgsSrc {}).stdenv.mkDerivation { + src = nixpkgsSrc; + phases = [ "unpackPhase" "installPhase" ]; + installPhase = '' + sed -i -re 's!]*)>!!g' \ + nixos/modules/installer/tools/nixos-rebuild.sh + cp -r . "$out" + ''; + }; + in if nixpkgsSrc == null then else patchedNixpkgs; + system = "x86_64-linux"; pkgsUpstream = import nixpkgs { inherit system; }; root = import ./default.nix { inherit system; }; @@ -35,15 +44,13 @@ in with pkgsUpstream.lib; with builtins; { mkChannel = attrs: root.pkgs.mkChannel (rec { name = "vuizvui-channel-${attrs.name or "generic"}-${version}"; version = "${toString vuizvui.revCount}.${vuizvui.shortRev}"; - pkgsVer = "pre${toString nixpkgs.revCount}.${nixpkgs.shortRev}-vuizvui"; + pkgsVer = "pre${toString nixpkgsRevCount}.${nixpkgsShortRev}-vuizvui"; src = vuizvui; patchPhase = '' cp -r --no-preserve=mode,ownership "${nixpkgs}/" nixpkgs - find \( -iname '*.nix' -type f \ - -o -path ./nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh \ - \) -exec sed -i -re 's!]*)>!!g' {} + echo -n "$pkgsVer" > nixpkgs/.version-suffix - echo -n ${nixpkgs.rev or nixpkgs.shortRev} > nixpkgs/.git-revision + echo -n ${nixpkgs.rev or nixpkgsShortRev} > nixpkgs/.git-revision + echo './nixpkgs' > nixpkgs-path.nix touch .update-on-nixos-rebuild ''; } // removeAttrs attrs [ "name" ]); -- cgit 1.4.1