Skip to content

Commit

Permalink
ghc: Add variantSuffix.
Browse files Browse the repository at this point in the history
When debugging musl builds, I often have to sift through thousands of lines
of `nix-store -q --tree` or `nix-store -qR` output.
Until now, `pkgsMusl` and normal `pkgs` GHCs looked exactly the same in
there, making that task tough.

Same for `integer-simple`, which makes debugging `gmp` issues easier.

This commit introduces a suffix to tell them apart easily.

Note that this is different from `targetPrefix` which is for
cross-compilation, which `pkgsMusl` does not do.
  • Loading branch information
nh2 committed Sep 20, 2021
1 parent a51af7d commit b266503
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 7 deletions.
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/8.10.2-binary.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let
# nixpkgs uses for the respective system.
defaultLibc = {
i686-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
sha256 = "0bvwisl4w0z5z8z0da10m9sv0mhm9na2qm43qxr8zl23mn32mblx";
Expand All @@ -54,6 +55,7 @@ let
];
};
x86_64-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz";
sha256 = "0chnzy9j23b2wa8clx5arwz8wnjfxyjmz9qkj548z14cqf13slcl";
Expand All @@ -65,6 +67,7 @@ let
];
};
armv7l-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz";
sha256 = "1j41cq5d3rmlgz7hzw8f908fs79gc5mn3q5wz277lk8zdf19g75v";
Expand All @@ -76,6 +79,7 @@ let
];
};
aarch64-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz";
sha256 = "14smwl3741ixnbgi0l51a7kh7xjkiannfqx15b72svky0y4l3wjw";
Expand All @@ -88,6 +92,7 @@ let
];
};
x86_64-darwin = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
sha256 = "1hngyq14l4f950hzhh2d204ca2gfc98pc9xdasxihzqd1jq75dzd";
Expand All @@ -103,6 +108,7 @@ let
# Binary distributions for the musl libc for the respective system.
musl = {
x86_64-linux = {
variantSuffix = "-musl";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-alpine3.10-linux-integer-simple.tar.xz";
sha256 = "0xpcbyaxqyhbl6f0i3s4rp2jm67nqpkfh2qlbj3i2fiaix89ml0l";
Expand Down Expand Up @@ -139,7 +145,7 @@ in
stdenv.mkDerivation rec {
inherit version;

name = "ghc-${version}-binary";
name = "ghc-${version}-binary${binDistUsed.variantSuffix}";

src = fetchurl binDistUsed.src;

Expand Down
9 changes: 8 additions & 1 deletion pkgs/development/compilers/ghc/8.10.7-binary.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let
# nixpkgs uses for the respective system.
defaultLibc = {
i686-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-i386-deb9-linux.tar.xz";
sha256 = "fbfc1ef194f4e7a4c0da8c11cc69b17458a4b928b609b3622c97acc4acd5c5ab";
Expand All @@ -55,6 +56,7 @@ let
];
};
x86_64-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-deb10-linux.tar.xz";
sha256 = "a13719bca87a0d3ac0c7d4157a4e60887009a7f1a8dbe95c4759ec413e086d30";
Expand All @@ -66,6 +68,7 @@ let
];
};
armv7l-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-armv7-deb10-linux.tar.xz";
sha256 = "3949c31bdf7d3b4afb765ea8246bca4ca9707c5d988d9961a244f0da100956a2";
Expand All @@ -77,6 +80,7 @@ let
];
};
aarch64-linux = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-deb10-linux.tar.xz";
sha256 = "fad2417f9b295233bf8ade79c0e6140896359e87be46cb61cd1d35863d9d0e55";
Expand All @@ -89,6 +93,7 @@ let
];
};
x86_64-darwin = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
sha256 = "287db0f9c338c9f53123bfa8731b0996803ee50f6ee847fe388092e5e5132047";
Expand All @@ -101,6 +106,7 @@ let
];
};
aarch64-darwin = {
variantSuffix = "";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz";
sha256 = "dc469fc3c35fd2a33a5a575ffce87f13de7b98c2d349a41002e200a56d9bba1c";
Expand All @@ -116,6 +122,7 @@ let
# Binary distributions for the musl libc for the respective system.
musl = {
x86_64-linux = {
variantSuffix = "-musl-integer-simple";
src = {
url = "${downloadsUrl}/${version}/ghc-${version}-x86_64-alpine3.10-linux-integer-simple.tar.xz";
sha256 = "16903df850ef73d5246f2ff169cbf57ecab76c2ac5acfa9928934282cfad575c";
Expand Down Expand Up @@ -153,7 +160,7 @@ in
stdenv.mkDerivation rec {
inherit version;

name = "ghc-${version}-binary";
name = "ghc-${version}-binary${binDistUsed.variantSuffix}";

src = fetchurl binDistUsed.src;

Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/8.10.7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,16 @@ let
targetPackages.stdenv.cc.bintools.bintools
];

# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableIntegerSimple "-integer-simple")
];

in
stdenv.mkDerivation (rec {
version = "8.10.7";
name = "${targetPrefix}ghc-${version}";
name = "${targetPrefix}ghc-${version}${variantSuffix}";

src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/8.8.4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,16 @@ let
targetPackages.stdenv.cc.bintools.bintools
];

# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableIntegerSimple "-integer-simple")
];

in
stdenv.mkDerivation (rec {
version = "8.8.4";
name = "${targetPrefix}ghc-${version}";
name = "${targetPrefix}ghc-${version}${variantSuffix}";

src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/9.0.1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,16 @@ let
targetPackages.stdenv.cc.bintools.bintools
];

# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableIntegerSimple "-integer-simple")
];

in
stdenv.mkDerivation (rec {
version = "9.0.1";
name = "${targetPrefix}ghc-${version}";
name = "${targetPrefix}ghc-${version}${variantSuffix}";

src = fetchurl {
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/9.2.1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,16 @@ let
targetPackages.stdenv.cc.bintools.bintools
];

# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableIntegerSimple "-integer-simple")
];

in
stdenv.mkDerivation (rec {
version = "9.2.0.20210821";
name = "${targetPrefix}ghc-${version}";
name = "${targetPrefix}ghc-${version}${variantSuffix}";

src = fetchurl {
url = "https://downloads.haskell.org/ghc/9.2.1-rc1/ghc-${version}-src.tar.xz";
Expand Down
8 changes: 7 additions & 1 deletion pkgs/development/compilers/ghc/head.nix
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,17 @@ let
targetPackages.stdenv.cc.bintools.bintools
];

# Makes debugging easier to see which variant is at play in `nix-store -q --tree`.
variantSuffix = lib.concatStrings [
(lib.optionalString stdenv.hostPlatform.isMusl "-musl")
(lib.optionalString enableIntegerSimple "-integer-simple")
];

in
stdenv.mkDerivation (rec {
inherit version;
inherit (src) rev;
name = "${targetPrefix}ghc-${version}";
name = "${targetPrefix}ghc-${version}${variantSuffix}";

src = fetchgit {
url = "https://gitlab.haskell.org/ghc/ghc.git/";
Expand Down

0 comments on commit b266503

Please sign in to comment.