summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorNiklas Hambüchen <mail@nh2.me>2021-07-04 18:11:47 +0000
committerNiklas Hambüchen <mail@nh2.me>2021-07-05 16:38:24 +0200
commit67e8744ef8450d6bf6d529ed13dc7172842be425 (patch)
treea41ff41da225e9852ac70804c0e4fd7bb9ef41b4 /pkgs/development/compilers
parent947f757bba6a540272af9339c7ad278bd0bd6c1f (diff)
downloadnixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar.gz
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar.bz2
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar.lz
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar.xz
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.tar.zst
nixpkgs-67e8744ef8450d6bf6d529ed13dc7172842be425.zip
ghc: Refactor: Extract `ghcBinDists`
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/8.10.2-binary.nix71
1 files changed, 43 insertions, 28 deletions
diff --git a/pkgs/development/compilers/ghc/8.10.2-binary.nix b/pkgs/development/compilers/ghc/8.10.2-binary.nix
index a0e84c4502b..69708add3e1 100644
--- a/pkgs/development/compilers/ghc/8.10.2-binary.nix
+++ b/pkgs/development/compilers/ghc/8.10.2-binary.nix
@@ -14,6 +14,47 @@
 assert stdenv.targetPlatform == stdenv.hostPlatform;
 
 let
+  downloadsUrl = "https://downloads.haskell.org/ghc";
+
+  version = "8.10.2";
+
+  # Information about available bindists that we use in the build.
+  ghcBinDists = {
+    i686-linux = {
+      src = {
+        url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
+        sha256 = "0bvwisl4w0z5z8z0da10m9sv0mhm9na2qm43qxr8zl23mn32mblx";
+      };
+    };
+    x86_64-linux = {
+      src = {
+        url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz";
+        sha256 = "0chnzy9j23b2wa8clx5arwz8wnjfxyjmz9qkj548z14cqf13slcl";
+      };
+    };
+    armv7l-linux = {
+      src = {
+        url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz";
+        sha256 = "1j41cq5d3rmlgz7hzw8f908fs79gc5mn3q5wz277lk8zdf19g75v";
+      };
+    };
+    aarch64-linux = {
+      src = {
+        url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz";
+        sha256 = "14smwl3741ixnbgi0l51a7kh7xjkiannfqx15b72svky0y4l3wjw";
+      };
+    };
+    x86_64-darwin = {
+      src = {
+        url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
+        sha256 = "1hngyq14l4f950hzhh2d204ca2gfc98pc9xdasxihzqd1jq75dzd";
+      };
+    };
+  };
+
+  binDistUsed = ghcBinDists.${stdenv.hostPlatform.system}
+    or (throw "cannot bootstrap GHC on this platform");
+
   useLLVM = !stdenv.targetPlatform.isx86;
 
   libPath = lib.makeLibraryPath ([
@@ -30,40 +71,14 @@ let
        ''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
     else
       "${lib.getLib glibc}/lib/ld-linux*";
-
-  downloadsUrl = "https://downloads.haskell.org/ghc";
-
 in
 
 stdenv.mkDerivation rec {
-  version = "8.10.2";
+  inherit version;
 
   name = "ghc-${version}-binary";
 
-  # https://downloads.haskell.org/~ghc/8.10.2/
-  src = fetchurl ({
-    i686-linux = {
-      url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
-      sha256 = "0bvwisl4w0z5z8z0da10m9sv0mhm9na2qm43qxr8zl23mn32mblx";
-    };
-    x86_64-linux = {
-      url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz";
-      sha256 = "0chnzy9j23b2wa8clx5arwz8wnjfxyjmz9qkj548z14cqf13slcl";
-    };
-    armv7l-linux = {
-      url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz";
-      sha256 = "1j41cq5d3rmlgz7hzw8f908fs79gc5mn3q5wz277lk8zdf19g75v";
-    };
-    aarch64-linux = {
-      url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz";
-      sha256 = "14smwl3741ixnbgi0l51a7kh7xjkiannfqx15b72svky0y4l3wjw";
-    };
-    x86_64-darwin = {
-      url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
-      sha256 = "1hngyq14l4f950hzhh2d204ca2gfc98pc9xdasxihzqd1jq75dzd";
-    };
-  }.${stdenv.hostPlatform.system}
-    or (throw "cannot bootstrap GHC on this platform"));
+  src = fetchurl binDistUsed.src;
 
   nativeBuildInputs = [ perl ];
   propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];