diff --git a/release.nix b/release.nix index 5230d6b..b49beda 100644 --- a/release.nix +++ b/release.nix @@ -81,7 +81,7 @@ in let # The nix provided nix/unpack-channel.nix function extracts the nixpkgs from the channel, # nixpkgs = - ( import rec { + ( pkgs.callPackage ./unpack-channel.nix { } rec { name = "nixos"; channelName = "${name}-${version}"; src = channel + /tarballs + "/${name}-${version}${nixpkgsVersion.suffix}.tar.xz"; diff --git a/unpack-channel.nix b/unpack-channel.nix new file mode 100644 index 0000000..13d7198 --- /dev/null +++ b/unpack-channel.nix @@ -0,0 +1,45 @@ +# Hydra runs the newer nix which doesn't have corepkgs/unpack-channel.nix. The nix-daemon runs the older nix which +# doesn't have builtins:unpack-channel. This means +# +# - for now we need to provide the older corepkgs/unpack-channel.nix +# - in the future we should switch to src/nix-channel/unpack-channel.nix + +{ bash, coreutils, gnutar, xz, gzip, bzip2 }: + +let + + tarFlags = "--warning=no-timestamp"; + + builder = builtins.toFile "unpack-channel.sh" + '' + mkdir $out + cd $out + xzpat="\.xz\$" + gzpat="\.gz\$" + if [[ "$src" =~ $xzpat ]]; then + xz -d < $src | tar xf - ${tarFlags} + elif [[ "$src" =~ $gzpat ]]; then + gzip -d < $src | tar xf - ${tarFlags} + else + bzip2 -d < $src | tar xf - ${tarFlags} + fi + if [ * != $channelName ]; then + mv * $out/$channelName + fi + ''; + +in + +{ name, channelName, src }: + +derivation { + system = builtins.currentSystem; + builder = "${bash}/bin/sh"; + args = [ "-e" builder ]; + inherit name channelName src; + + PATH = "${coreutils}/bin:${gnutar}/bin:${xz}/bin:${gzip}/bin:${bzip2}/bin"; + + # No point in doing this remotely. + preferLocalBuild = true; +}