on iko/ghcjs-patch-master help sign in
Get the hackage index tarball at runtime, not eval time (#512)

* Get the hackage index tarball at runtime, not eval time * Get rid of special case for update-hackage Fixes #507.

commitb6a8a97249624583498d37541b0ca85d72a8e4db authorMichael Peyton Jones <michael.peyton-jones@iohk.io> dateWed 25 Mar 2020, 12:26 (7 years ago) parent64700ae
3 files changed+6−11
ci.nix+1−5 overlays/haskell.nix+1−1 scripts/update-index-state-hashes.nix+4−5
ci.nix+1−5
@@ -36,11 +36,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
3636 let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system; });
3737 build = import ./build.nix { inherit pkgs ifdLevel; };
3838 platformFilter = platformFilterGeneric pkgs system;
39− blacklisted = n:
40− # update-hackage accesses the hackage index at eval time (!), which doesn't work in restricted mode
41− # https://github.com/input-output-hk/haskell.nix/issues/507
42− (restrictEval && (n == "update-hackage")) ;
43− in filterAttrsOnlyRecursive (n: v: !(blacklisted n) && platformFilter v) {
39+ in filterAttrsOnlyRecursive (_: v: platformFilter v) {
4440 # Native builds
4541 # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
4642 native = pkgs.recurseIntoAttrs {
overlays/haskell.nix+1−1
@@ -210,7 +210,7 @@ self: super: {
210210
211211 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
212212 inherit (self.haskell-nix) indexStateHashesPath nix-tools;
213− inherit (self) coreutils nix writeShellScriptBin stdenv;
213+ inherit (self) coreutils nix writeShellScriptBin stdenv curl;
214214 };
215215
216216 # Function to call stackToNix
scripts/update-index-state-hashes.nix+4−5
@@ -1,10 +1,8 @@
1−{ indexStateHashesPath, nix-tools, coreutils, nix, writeShellScriptBin, stdenv }:
1+{ indexStateHashesPath, nix-tools, coreutils, nix, writeShellScriptBin, stdenv, curl }:
22with builtins;
33with stdenv.lib;
44writeShellScriptBin "update-index-state-hashes" ''
5− # get all the tools we need. I wonder if there is a better way? But I couldn't find
6− # any buildInputs for writeShellScriptBin :-/
7− export PATH="${getBin coreutils}/bin:${getBin nix-tools}/bin:${getBin nix}/bin:$PATH"
5+ export PATH="${makeBinPath [ coreutils nix-tools nix]}"
86
97 # We'll take the last element from the indexStatesHashes file via nix and get the name.
108 # This is the last timestamp recorded in the file (implicit assumption: the file is
@@ -31,7 +29,8 @@ writeShellScriptBin "update-index-state-hashes" ''
3129
3230 # ensure we don't generate the $start date twice (skip the first invocation).
3331 if [[ "''${dt}T00:00:00Z" != "$start" ]]; then
34− truncate-index -o ''${dt}-01-index.tar.gz -i ${fetchurl "https://hackage.haskell.org/01-index.tar.gz"} -s "''${dt}T00:00:00Z"
32+ curl "https://hackage.haskell.org/01-index.tar.gz" --output index.tar.gz --fail-early
33+ truncate-index -o ''${dt}-01-index.tar.gz -i index.tar.gz -s "''${dt}T00:00:00Z"
3534 sha256=$(nix-hash --flat --type sha256 ''${dt}-01-index.tar.gz)
3635 echo " \"''${dt}T00:00:00Z\" = \"''${sha256}\";"
3736 fi