summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-05-08 13:55:59 +0200
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-05-08 19:56:05 +0200
commitb47b2f5ab791d99eebdd8e88352575b52aebb80c (patch)
treeacf262318cdd90ac61ab4eebf5c91e9092b506df
parent8cca9b16342885a32a2fa8be4d9412b2e94749bb (diff)
downloadnixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar.gz
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar.bz2
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar.lz
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar.xz
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.tar.zst
nixpkgs-b47b2f5ab791d99eebdd8e88352575b52aebb80c.zip
haskell.packages: move arm specific overrides into dedicated config
This should clean up configuration-common.nix of a lot of conditional
which were a pain to write and maintain.
-rw-r--r--pkgs/development/haskell-modules/configuration-arm.nix71
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix69
-rw-r--r--pkgs/development/haskell-modules/default.nix11
3 files changed, 82 insertions, 69 deletions
diff --git a/pkgs/development/haskell-modules/configuration-arm.nix b/pkgs/development/haskell-modules/configuration-arm.nix
new file mode 100644
index 00000000000..bcbf3254053
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-arm.nix
@@ -0,0 +1,71 @@
+# ARM-SPECIFIC OVERRIDES FOR THE HASKELL PACKAGE SET IN NIXPKGS
+#
+# This extension is applied to all haskell package sets in nixpkgs
+# if `stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64`
+# to apply arm specific workarounds or fixes.
+#
+# The file is split into three parts:
+#
+# * Overrides that are applied for all arm platforms
+# * Overrides for aarch32 platforms
+# * Overrides for aarch64 platforms
+#
+# This may be extended in the future to also include compiler-
+# specific sections as compiler and linker related bugs may
+# get fixed subsequently.
+#
+# When adding new overrides, try to research which section they
+# belong into. Most likely we'll be favouring aarch64 overrides
+# in practice since that is the only platform we can test on
+# Hydra. Also take care to group overrides by the issue they
+# solve, so refactors and updates to this file are less tedious.
+{ pkgs, haskellLib }:
+
+let
+  inherit (pkgs) lib;
+in
+
+with haskellLib;
+
+self: super: {
+  # COMMON ARM OVERRIDES
+
+  # moved here from configuration-common.nix, no reason given.
+  servant-docs = dontCheck super.servant-docs;
+  swagger2 = dontHaddock (dontCheck super.swagger2);
+
+  # Similar to https://ghc.haskell.org/trac/ghc/ticket/13062
+  happy = dontCheck super.happy;
+
+} // lib.optionalAttrs pkgs.stdenv.hostPlatform.isAarch64 {
+  # AARCH64-SPECIFIC OVERRIDES
+
+  # Doctests fail on aarch64 due to a GHCi linking bug
+  # https://gitlab.haskell.org/ghc/ghc/-/issues/15275#note_295437
+  # TODO: figure out if needed on aarch32 as well
+  language-nix = dontCheck super.language-nix;
+  trifecta = dontCheck super.trifecta;
+  ad = dontCheck super.ad;
+  vinyl = dontCheck super.vinyl;
+  BNFC = dontCheck super.BNFC;
+  C-structs = dontCheck super.C-structs;
+  accelerate = dontCheck super.accelerate;
+  focuslist = dontCheck super.focuslist;
+  flight-kml = dontCheck super.flight-kml;
+  exact-real = dontCheck super.exact-real;
+  autoapply = dontCheck super.autoapply;
+  hint = dontCheck super.hint;
+  hgeometry = dontCheck super.hgeometry;
+  headroom = dontCheck super.headroom;
+  haskell-time-range = dontCheck super.haskell-time-range;
+  hsakamai = dontCheck super.hsakamai;
+  hsemail-ns = dontCheck super.hsemail-ns;
+  openapi3 = dontCheck super.openapi3;
+
+  # https://github.com/ekmett/half/issues/35
+  half = dontCheck super.half;
+
+} // lib.optionalAttrs pkgs.stdenv.hostPlatform.isAarch32 {
+  # AARCH32-SPECIFIC OVERRIDES
+
+}
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 8637de9495f..9c60be7d64e 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -307,7 +307,6 @@ self: super: {
   integer-roots = dontCheck super.integer-roots; # requires an old version of smallcheck, will be fixed in > 1.0
   itanium-abi = dontCheck super.itanium-abi;
   katt = dontCheck super.katt;
-  language-nix = if (pkgs.stdenv.hostPlatform.isAarch64 || pkgs.stdenv.hostPlatform.isi686) then dontCheck super.language-nix else super.language-nix; # aarch64: https://ghc.haskell.org/trac/ghc/ticket/15275
   language-slice = dontCheck super.language-slice;
   ldap-client = dontCheck super.ldap-client;
   lensref = dontCheck super.lensref;
@@ -852,16 +851,9 @@ self: super: {
     configureFlags = ["--ghc-option=-DU_DEFINE_FALSE_AND_TRUE=1"]; # https://github.com/haskell/text-icu/issues/49
   });
 
-  # aarch64 and armv7l fixes.
-  happy = if (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) then dontCheck super.happy else super.happy; # Similar to https://ghc.haskell.org/trac/ghc/ticket/13062
-  servant-docs =
-    let
-      f = if (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64)
-          then dontCheck
-          else pkgs.lib.id;
-    in doJailbreak (f super.servant-docs); # jailbreak tasty < 1.2 until servant-docs > 0.11.3 is on hackage.
+  # jailbreak tasty < 1.2 until servant-docs > 0.11.3 is on hackage.
+  servant-docs = doJailbreak super.servant-docs;
   snap-templates = doJailbreak super.snap-templates; # https://github.com/snapframework/snap-templates/issues/22
-  swagger2 = if (pkgs.stdenv.hostPlatform.isAarch32 || pkgs.stdenv.hostPlatform.isAarch64) then dontHaddock (dontCheck super.swagger2) else super.swagger2;
 
   # hledger-lib requires the latest version of pretty-simple
   hledger-lib = appendPatch super.hledger-lib
@@ -1526,11 +1518,6 @@ self: super: {
   # Due to tests restricting base in 0.8.0.0 release
   http-media = doJailbreak super.http-media;
 
-  # https://github.com/ekmett/half/issues/35
-  half = if pkgs.stdenv.isAarch64
-    then dontCheck super.half
-    else super.half;
-
   # 2020-11-19: Jailbreaking until: https://github.com/snapframework/heist/pull/124
   heist = doJailbreak super.heist;
 
@@ -1876,58 +1863,6 @@ self: super: {
     '' + (drv.postPatch or "");
   });
 
-  # Doctests fail on aarch64 due to a GHCi linking bug
-  # https://gitlab.haskell.org/ghc/ghc/-/issues/15275#note_295437
-  ad = overrideCabal super.ad {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  trifecta = if pkgs.stdenv.hostPlatform.isAarch64 then dontCheck super.trifecta else super.trifecta;
-  vinyl = overrideCabal super.vinyl {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  BNFC = overrideCabal super.BNFC {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  C-structs = overrideCabal super.C-structs {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  accelerate = overrideCabal super.accelerate {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  focuslist = overrideCabal super.focuslist {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  flight-kml = overrideCabal super.flight-kml {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  exact-real = overrideCabal super.exact-real {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  autoapply = overrideCabal super.autoapply {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  hint = overrideCabal super.hint {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  hgeometry = overrideCabal super.hgeometry {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  headroom = overrideCabal super.headroom {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  haskell-time-range = overrideCabal super.haskell-time-range {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  hsakamai = overrideCabal super.hsakamai {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  hsemail-ns = overrideCabal super.hsemail-ns {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-  openapi3 = overrideCabal super.openapi3 {
-    doCheck = !pkgs.stdenv.hostPlatform.isAarch64;
-  };
-
   # Tests need to lookup target triple x86_64-unknown-linux
   # https://github.com/llvm-hs/llvm-hs/issues/334
   llvm-hs = overrideCabal super.llvm-hs {
diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix
index 61c79748866..d4430f7a9f1 100644
--- a/pkgs/development/haskell-modules/default.nix
+++ b/pkgs/development/haskell-modules/default.nix
@@ -7,6 +7,7 @@
 , nonHackagePackages ? import ./non-hackage-packages.nix
 , configurationCommon ? import ./configuration-common.nix
 , configurationNix ? import ./configuration-nix.nix
+, configurationArm ? import ./configuration-arm.nix
 }:
 
 let
@@ -19,14 +20,20 @@ let
     inherit stdenv haskellLib ghc buildHaskellPackages extensible-self all-cabal-hashes;
   };
 
-  extensions = lib.composeManyExtensions [
+  isArm = with stdenv.hostPlatform; isAarch64 || isAarch32;
+  platformConfigurations = lib.optionals isArm [
+    (configurationArm { inherit pkgs haskellLib; })
+  ];
+
+  extensions = lib.composeManyExtensions ([
     nonHackagePackages
     (configurationNix { inherit pkgs haskellLib; })
     (configurationCommon { inherit pkgs haskellLib; })
+  ] ++ platformConfigurations ++ [
     compilerConfig
     packageSetConfig
     overrides
-  ];
+  ]);
 
   extensible-self = makeExtensible (extends extensions haskellPackages);