nixpkgs-suyu/pkgs/development
Rebecca Turner 17d63282b2 haskell.compiler: allow overriding source with hadrian
Hadrian (the GHC build tool) is built separately from GHC. This means
that if `haskell.compiler.ghc961` is overridden to add patches, those
patches will _only_ be applied to the GHC portion of the build, and not
the Hadrian build. For example, backporting this patch to GHC 9.6.1
failed because the changes to `hadrian/` files were not reflected in the
Nix build:

5ed77deb1b

By lifting `src` and `hadrian` from variables defined in the function
body to parameters with default values, the `hadrian/` files can be
overridden using the `haskell.compiler.ghc961.override` function. For
example:

   self.haskell.compiler.ghc961.override {
     # The GHC 9.6 builder in nixpkgs first builds hadrian with the
     # source tree provided here and then uses the built hadrian to
     # build the rest of GHC. We need to make sure our patches get
     # included in this `src`, then, rather than modifying the tree in
     # the `patchPhase` or `postPatch` of the outer builder.
     src = self.applyPatches {
       src = let
         version = "9.6.1";
       in
         self.fetchurl {
           url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-src.tar.xz";
           sha256 = "fe5ac909cb8bb087e235de97fa63aff47a8ae650efaa37a2140f4780e21f34cb";
         };

       patches = [
         # Enable response files for linker if supported
         (self.fetchpatch {
           url = "5ed77deb1b.patch";
           hash = "sha256-dvenK+EPTZJYXnyfKPdkvLp+zeUmsY9YrWpcGCzYStM=";
         })
       ];
     };
   }

Note that we do have to re-declare the `src` we want, but I'm not sure
of a good way to avoid this while also sharing one set of patches
between the GHC and Hadrian builds.
2023-06-08 20:11:52 +02:00
..
androidndk-pkgs
beam-modules
bower-modules/generic
chez-modules
compilers haskell.compiler: allow overriding source with hadrian 2023-06-08 20:11:52 +02:00
coq-modules
dhall-modules
dotnet-modules
em-modules/generic
embedded
gnuradio-modules
guile-modules
haskell-modules
idris-modules
interpreters
java-modules Merge pull request #218669 from avdv/gephi-0.10.1 2023-06-08 14:15:44 +02:00
libraries Merge pull request #236636 from r-ryantm/auto-update/cpp-utilities 2023-06-08 20:29:21 +03:00
lisp-modules
lisp-modules-new-obsolete
lisp-modules-obsolete
lua-modules
misc
mobile
nim-packages
node-packages
ocaml-modules headache: move from ocamlPackages to top-level 2023-06-08 14:51:17 +02:00
octave-modules
perl-modules
pharo
php-packages
python-modules Merge pull request #236547 from fabaff/favicon-pytest-runner 2023-06-08 18:51:50 +02:00
python2-modules
quickemu
r-modules
rocm-modules/update-script
ruby-modules
scheme-modules/scheme-bytestructures
skaware-packages
tools Merge pull request #235888 from kirillrdy/ent 2023-06-08 18:51:19 +02:00
web