on iko/ghcjs-patch-master help sign in
Get the hackage index tarball at runtime, not eval time (#512)
b6a8a97Michael Peyton Jones
@@ -36,11 +36,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
36 let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system; });
36 let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system; });
37 build = import ./build.nix { inherit pkgs ifdLevel; };
37 build = import ./build.nix { inherit pkgs ifdLevel; };
38 platformFilter = platformFilterGeneric pkgs system;
38 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) {
44 # Native builds
40 # Native builds
45 # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
41 # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
46 native = pkgs.recurseIntoAttrs {
42 native = pkgs.recurseIntoAttrs {
overlays/haskell.nix+1−1
@@ -210,7 +210,7 @@ self: super: {
210
210
211 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
211 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
212 inherit (self.haskell-nix) indexStateHashesPath nix-tools;
212 inherit (self.haskell-nix) indexStateHashesPath nix-tools;
213− inherit (self) coreutils nix writeShellScriptBin stdenv;
213+ inherit (self) coreutils nix writeShellScriptBin stdenv curl;
214 };
214 };
215
215
216 # Function to call stackToNix
216 # 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 }:
2with builtins;
2with builtins;
3with stdenv.lib;
3with stdenv.lib;
4writeShellScriptBin "update-index-state-hashes" ''
4writeShellScriptBin "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]}"
8
6
9 # We'll take the last element from the indexStatesHashes file via nix and get the name.
7 # We'll take the last element from the indexStatesHashes file via nix and get the name.
10 # This is the last timestamp recorded in the file (implicit assumption: the file is
8 # This is the last timestamp recorded in the file (implicit assumption: the file is
@@ -31,7 +29,8 @@ writeShellScriptBin "update-index-state-hashes" ''
31
29
32 # ensure we don't generate the $start date twice (skip the first invocation).
30 # ensure we don't generate the $start date twice (skip the first invocation).
33 if [[ "''${dt}T00:00:00Z" != "$start" ]]; then
31 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"
35 sha256=$(nix-hash --flat --type sha256 ''${dt}-01-index.tar.gz)
34 sha256=$(nix-hash --flat --type sha256 ''${dt}-01-index.tar.gz)
36 echo " \"''${dt}T00:00:00Z\" = \"''${sha256}\";"
35 echo " \"''${dt}T00:00:00Z\" = \"''${sha256}\";"
37 fi
36 fi