nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 97 lines 2.5 kB view raw
1# See also ./make-hadrian.nix 2{ 3 mkDerivation, 4 base, 5 bytestring, 6 Cabal, 7 containers, 8 directory, 9 extra, 10 filepath, 11 lib, 12 mtl, 13 parsec, 14 shake, 15 text, 16 transformers, 17 unordered-containers, 18 cryptohash-sha256, 19 base16-bytestring, 20 writeText, 21 # Dependencies that are not on Hackage and only used in certain Hadrian versions 22 ghc-platform ? null, 23 ghc-toolchain ? null, 24 # GHC source tree to build hadrian from 25 ghcSrc, 26 ghcVersion, 27 # GHC we are using to bootstrap hadrian (stage0) 28 bootGhcVersion, 29 # Customization 30 userSettings ? null, 31}: 32 33mkDerivation { 34 pname = "hadrian"; 35 version = ghcVersion; 36 src = ghcSrc; 37 postUnpack = '' 38 sourceRoot="$sourceRoot/hadrian" 39 ''; 40 # Overwrite UserSettings.hs with a provided custom one 41 postPatch = lib.optionalString (userSettings != null) '' 42 install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs 43 ''; 44 configureFlags = [ 45 # avoid QuickCheck dep which needs shared libs / TH 46 "-f-selftest" 47 # Building hadrian with -O1 takes quite some time with little benefit. 48 # Additionally we need to recompile it on every change of UserSettings.hs. 49 # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190 50 "-O0" 51 ]; 52 jailbreak = 53 # Ignore bound directory >= 1.3.9.0, unless the bootstrapping GHC ships it 54 # which is the case for >= 9.12. Upstream uses this to avoid a race condition 55 # that only seems to affect Windows. We never build GHC natively on Windows. 56 # See also https://gitlab.haskell.org/ghc/ghc/-/issues/24382, 57 # https://gitlab.haskell.org/ghc/ghc/-/commit/a2c033cf826, 58 # https://gitlab.haskell.org/ghc/ghc/-/commit/7890f2d8526… 59 ( 60 lib.versionOlder bootGhcVersion "9.12" 61 && ( 62 (lib.versionAtLeast ghcVersion "9.6.7" && lib.versionOlder ghcVersion "9.7") 63 || lib.versionAtLeast ghcVersion "9.11" 64 ) 65 ); 66 isLibrary = false; 67 isExecutable = true; 68 executableHaskellDepends = [ 69 base 70 bytestring 71 Cabal 72 containers 73 directory 74 extra 75 filepath 76 mtl 77 parsec 78 shake 79 text 80 transformers 81 unordered-containers 82 ] 83 ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [ 84 cryptohash-sha256 85 base16-bytestring 86 ] 87 ++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [ 88 ghc-platform 89 ghc-toolchain 90 ]; 91 passthru = { 92 # Expose »private« dependencies if any 93 inherit ghc-platform ghc-toolchain; 94 }; 95 description = "GHC build system"; 96 license = lib.licenses.bsd3; 97}