about summary refs log tree commit diff
path: root/pkgs/development/tools/haskell
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-05-15 11:40:11 +0200
committersternenseemann <sternenseemann@systemli.org>2022-09-22 16:18:17 +0200
commitda60f2dc9c95692804fa6575fa467e659de5031b (patch)
treef4625aa1adc726ad5826af7b53392500714c96c8 /pkgs/development/tools/haskell
parent41622a3f98416365894f23a4f0dab0df3930b836 (diff)
haskell.compiler.ghcHEAD: 9.3.20220406 -> 9.5.20220921
Initial port of our GHC Nix expressions to the new hadrian build system,
as it has become required after 9.4. Unfortunately there are some
regressions affecting us, namely the inability to install a GHC
cross-compiler at the moment (see issue linked in relevant error
message). This means that a lot of specific configuration snippets for
cross-platforms and static compilation have been ported from make
speculatively, as we are unable to test them for the moment.
Diffstat (limited to 'pkgs/development/tools/haskell')
-rw-r--r--pkgs/development/tools/haskell/hadrian/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/tools/haskell/hadrian/default.nix b/pkgs/development/tools/haskell/hadrian/default.nix
new file mode 100644
index 0000000000000..de10210ecd3e4
--- /dev/null
+++ b/pkgs/development/tools/haskell/hadrian/default.nix
@@ -0,0 +1,41 @@
+{ # GHC source tree to build hadrian from
+  ghcSrc ? null, ghcVersion ? null
+, mkDerivation, base, bytestring, Cabal, containers, directory
+, extra, filepath, lib, mtl, parsec, shake, text, transformers
+, unordered-containers
+, userSettings ? null
+, writeText
+}:
+
+if ghcSrc == null || ghcVersion == null
+then throw "hadrian: need to specify ghcSrc and ghcVersion arguments manually"
+else
+
+mkDerivation {
+  pname = "hadrian";
+  version = ghcVersion;
+  src = ghcSrc;
+  postUnpack = ''
+    sourceRoot="$sourceRoot/hadrian"
+  '';
+  # Overwrite UserSettings.hs with a provided custom one
+  postPatch = lib.optionalString (userSettings != null) ''
+    install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs
+  '';
+  configureFlags = [
+    # avoid QuickCheck dep which needs shared libs / TH
+    "-f-selftest"
+    # Building hadrian with -O1 takes quite some time with little benefit.
+    # Additionally we need to recompile it on every change of UserSettings.hs.
+    # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190
+    "-O0"
+  ];
+  isLibrary = false;
+  isExecutable = true;
+  executableHaskellDepends = [
+    base bytestring Cabal containers directory extra filepath mtl
+    parsec shake text transformers unordered-containers
+  ];
+  description = "GHC build system";
+  license = lib.licenses.bsd3;
+}