From fac1168816a132694a3f21f2e00654f69ab44e5f Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Tue, 1 Nov 2016 18:29:43 +0100 Subject: [PATCH] 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"; }; } --- pkgs/data/misc/hackage/default.nix | 11 +++++++++++ pkgs/development/haskell-modules/default.nix | 14 +++----------- pkgs/top-level/all-packages.nix | 2 ++ 3 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 pkgs/data/misc/hackage/default.nix diff --git a/pkgs/data/misc/hackage/default.nix b/pkgs/data/misc/hackage/default.nix new file mode 100644 index 000000000000..812362d6b30c --- /dev/null +++ b/pkgs/data/misc/hackage/default.nix @@ -0,0 +1,11 @@ +{ fetchFromGitHub }: + +# Use builtins.fetchTarball "https://github.com/commercialhaskell/all-cabal-hashes/archive/hackage.tar.gz" +# instead if you want the latest Hackage automatically at the price of frequent re-downloads. + +fetchFromGitHub { + owner = "commercialhaskell"; + repo = "all-cabal-hashes"; + rev = "ee101d34ff8bd59897aa2eb0a124bcd3fb47ceec"; + sha256 = "1hky0s2c1rv1srfnhbyi3ny14rnfnnp2j9fsr4ylz76xyxgjf5wm"; +} diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index 9020f1ee4671..0c72173d2d0a 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 ''; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9a4614b6e5c6..1bd3e6d63f47 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4821,6 +4821,8 @@ in postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc"; }); + all-cabal-hashes = callPackage ../data/misc/hackage/default.nix { }; + inherit (ocamlPackages) haxe; hxcpp = callPackage ../development/compilers/haxe/hxcpp.nix { };