summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/default.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2016-11-01 18:29:43 +0100
committerPeter Simons <simons@cryp.to>2016-11-01 18:35:19 +0100
commitfac1168816a132694a3f21f2e00654f69ab44e5f (patch)
tree040297c6028957288e9d6cbd66a8bd9df3c9e5db /pkgs/development/haskell-modules/default.nix
parent0607fa18740f1c41b522c43f4f2422888354a901 (diff)
downloadnixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar.gz
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar.bz2
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar.lz
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar.xz
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.tar.zst
nixpkgs-fac1168816a132694a3f21f2e00654f69ab44e5f.zip
callHackage: make 'all-cabal-hashes' repository overridable
This commit changes callHackage to use a deterministic version of the Hackage
checkout from https://github.com/commercialhaskell/all-cabal-hashes by default.
This means that packages uploaded to Hackage after today will be available to
callHackage only after "pkgs/data/misc/hackage/default.nix" has been updated.

People who want the previous behavior where we always had the latest version of
Hackage available -- at the cost of frequent downloads from Github --, can add
the following override to their "~/.nixpkgs/config.nix" file:

  {
    packageOverrides = super: {
      all-cabal-hashes = builtins.fetchTarball "https://github.com/commercialhaskell/all-cabal-hashes/archive/hackage.tar.gz";
    };
  }
Diffstat (limited to 'pkgs/development/haskell-modules/default.nix')
-rw-r--r--pkgs/development/haskell-modules/default.nix14
1 files changed, 3 insertions, 11 deletions
diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix
index 9020f1ee467..0c72173d2d0 100644
--- a/pkgs/development/haskell-modules/default.nix
+++ b/pkgs/development/haskell-modules/default.nix
@@ -1,4 +1,4 @@
-{ pkgs, stdenv, ghc
+{ pkgs, stdenv, ghc, all-cabal-hashes
 , compilerConfig ? (self: super: {})
 , packageSetConfig ? (self: super: {})
 , overrides ? (self: super: {})
@@ -6,14 +6,6 @@
 
 let
 
-  allCabalFiles = stdenv.mkDerivation {
-    name = "all-cabal-hashes-0";
-    buildCommand = ''
-      mkdir -p $out
-      tar -C $out --strip-components=1 -x -f ${builtins.fetchurl "https://github.com/commercialhaskell/all-cabal-hashes/archive/hackage.tar.gz"}
-    '';
-  };
-
   inherit (stdenv.lib) fix' extends;
 
   haskellPackages = self:
@@ -69,8 +61,8 @@ let
         installPhase = ''
           export HOME="$TMP"
           mkdir $out
-          hash=$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' ${allCabalFiles}/${name}/${version}/${name}.json)
-          cabal2nix --compiler=${self.ghc.name} --system=${stdenv.system} --sha256=$hash ${allCabalFiles}/${name}/${version}/${name}.cabal >$out/default.nix
+          hash=$(sed -e 's/.*"SHA256":"//' -e 's/".*$//' ${all-cabal-hashes}/${name}/${version}/${name}.json)
+          cabal2nix --compiler=${self.ghc.name} --system=${stdenv.system} --sha256=$hash ${all-cabal-hashes}/${name}/${version}/${name}.cabal >$out/default.nix
         '';
       };