Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1# See also ./make-hadria.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 # Customization 28 userSettings ? null, 29}: 30 31mkDerivation { 32 pname = "hadrian"; 33 version = ghcVersion; 34 src = ghcSrc; 35 postUnpack = '' 36 sourceRoot="$sourceRoot/hadrian" 37 ''; 38 # Overwrite UserSettings.hs with a provided custom one 39 postPatch = lib.optionalString (userSettings != null) '' 40 install -m644 "${writeText "UserSettings.hs" userSettings}" src/UserSettings.hs 41 ''; 42 configureFlags = [ 43 # avoid QuickCheck dep which needs shared libs / TH 44 "-f-selftest" 45 # Building hadrian with -O1 takes quite some time with little benefit. 46 # Additionally we need to recompile it on every change of UserSettings.hs. 47 # See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/1190 48 "-O0" 49 ]; 50 jailbreak = 51 # Ignore lower bound on directory. Upstream uses this to avoid a race condition 52 # that only seems to affect Windows. We never build GHC natively on Windows. 53 # https://gitlab.haskell.org/ghc/ghc/-/issues/24382 54 # https://gitlab.haskell.org/ghc/ghc/-/commit/a2c033cf82635c83f3107706634bebee43297b99 55 (lib.versionAtLeast ghcVersion "9.6.7" && lib.versionOlder ghcVersion "9.7") 56 || (lib.versionAtLeast ghcVersion "9.12" && lib.versionOlder ghcVersion "9.15"); 57 isLibrary = false; 58 isExecutable = true; 59 executableHaskellDepends = [ 60 base 61 bytestring 62 Cabal 63 containers 64 directory 65 extra 66 filepath 67 mtl 68 parsec 69 shake 70 text 71 transformers 72 unordered-containers 73 ] 74 ++ lib.optionals (lib.versionAtLeast ghcVersion "9.7") [ 75 cryptohash-sha256 76 base16-bytestring 77 ] 78 ++ lib.optionals (lib.versionAtLeast ghcVersion "9.9") [ 79 ghc-platform 80 ghc-toolchain 81 ]; 82 passthru = { 83 # Expose »private« dependencies if any 84 inherit ghc-platform ghc-toolchain; 85 }; 86 description = "GHC build system"; 87 license = lib.licenses.bsd3; 88}