about summary refs log tree commit diff
path: root/release.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-04-28 11:32:08 +0200
committeraszlig <aszlig@redmoonstudios.org>2015-04-28 11:32:08 +0200
commit993471b1514fbd05211691a6a91232b676d42384 (patch)
treeef6aa72aff87478cb670a2ff5681d37bfc4ec057 /release.nix
parent86b11d5bb0661f8e210ae97be81458ef59c08679 (diff)
release.nix: Include nixpkgs tarball in channel.
Symlinking is actually a pretty bad idea, because we can only have one
channel expression tarball. Evaluation however doesn't realize the
referenced store paths, so we need to include them directly in the
channel tarball.

This also simplifies rewriting of the NIX_PATH references, because we
need to recurse the directory structure only once.

In order to be correctly recognized by nixos-rebuild and display useful
version info, we generate .git-version and .version-suffix now as well.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'release.nix')
-rw-r--r--release.nix27
1 files changed, 8 insertions, 19 deletions
diff --git a/release.nix b/release.nix
index 320dc217..4d603941 100644
--- a/release.nix
+++ b/release.nix
@@ -8,23 +8,6 @@ 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}";
-    src = nixpkgs;
-    phases = [ "unpackPhase" "patchPhase" "installPhase" ];
-    installPhase = "cp -r . \"$out\"";
-    patchPhase = (patchNixpkgsReference "'\"$out\"'") + ''
-      sed -i -re 's!<nixpkgs([^>]*)>!<vuizvui/nixpkgs\1>!g' \
-        nixos/modules/installer/tools/nixos-rebuild.sh
-    '';
-  };
-
 in with pkgsUpstream.lib; with builtins; {
 
   machines = mapAttrsRecursiveCond (m: !(m ? build)) (path: attrs:
@@ -46,9 +29,15 @@ 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";
       src = vuizvui;
-      patchPhase = (patchNixpkgsReference patchedNixpkgs) + ''
-        ln -s "${patchedNixpkgs}" nixpkgs
+      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!<nixpkgs([^>]*)>!<vuizvui/nixpkgs\1>!g' {} +
+        echo -n "$pkgsVer" > nixpkgs/.version-suffix
+        echo -n ${nixpkgs.rev or nixpkgs.shortRev} > nixpkgs/.git-revision
       '';
     } // removeAttrs attrs [ "name" ]);