1 # See also ./make-hadria.nix
2 { mkDerivation, base, bytestring, Cabal, containers, directory
3 , extra, filepath, lib, mtl, parsec, shake, text, transformers
4 , unordered-containers, cryptohash-sha256, base16-bytestring
6 # Dependencies that are not on Hackage and only used in certain Hadrian versions
9 # GHC source tree to build hadrian from
14 , enableHyperlinkedSource
22 sourceRoot="$sourceRoot/hadrian"
24 patches = lib.optionals (!enableHyperlinkedSource) [
25 ./disable-hyperlinked-source.patch
26 ] ++ lib.optionals (lib.elem ghcVersion [ "9.8.1" "9.8.2" ]) [
27 # Incorrect bounds on Cabal
28 # https://gitlab.haskell.org/ghc/ghc/-/issues/24100
29 ./hadrian-9.8.1-allow-Cabal-3.10.patch
31 # Overwrite UserSettings.hs with a provided custom one
32 postPatch = lib.optionalString (userSettings != null) ''
33 install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs
36 # avoid QuickCheck dep which needs shared libs / TH
38 # Building hadrian with -O1 takes quite some time with little benefit.
39 # Additionally we need to recompile it on every change of UserSettings.hs.
40 # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190
45 executableHaskellDepends = [
46 base bytestring Cabal containers directory extra filepath mtl
47 parsec shake text transformers unordered-containers
48 ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [
49 cryptohash-sha256 base16-bytestring
50 ] ++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [
51 ghc-platform ghc-toolchain
54 # Expose »private« dependencies if any
55 inherit ghc-platform ghc-toolchain;
57 description = "GHC build system";
58 license = lib.licenses.bsd3;