Closed jonathanlking closed 1 month ago
I intend to continue investigating this and will share thoughts here 📝 It's also very possible that I'm making a very silly mistake somewhere 😅
Commenting out https://github.com/nh2/static-haskell-nix/blob/88f1e2d57e3f4cd6d980eb3d8f99d5e60040ad54/survey/default.nix#L1594-L1596 I now get
nix-repl> pkgs = (import ./survey/default.nix { useArchiveFilesForTemplateHaskell = true; })
nix-repl> pkgs.haskellPackages.buildHaskellPackages.ghc
«derivation /nix/store/pd3h7k2f9p9290dhfch2wnwkp9714xgk-ghc-musl-9.2.7.drv»
nix-repl> pkgs.haskellPackages.ghc
«derivation /nix/store/6yvclb4xwmkwg632nmm2mdcaw94vfj7k-ghc-musl-9.2.7.drv»
So maybe this override isn't being applied "deep"/early enough? (So that it also applies to the packages within haskellPackages
and not just to the exposed buildHaskellPackages
?)
Unfortunately I'm pretty stumped on this 😔
For posterity, one approach to debugging I tried was:
~/github/nixpkgs
)mkDerivation
with mkDerivation = (_: break _) (makeOverridable mkDerivationImpl);
nix repl --debugger --ignore-try
pkgs = (import ./survey/default.nix { normalPkgs = (import ~/github/nixpkgs/default.nix {}); useArchiveFilesForTemplateHaskell = true; })
pkgs.haskellPackages.vector
, which triggers the breakpoint (multiple times!)ghc
/self.ghc
/buildHaskellPackages.ghc
/self.buildHaskellPackages.ghc
that are in scope.I didn't really learn anything new from this though, so I intend to stop investigating for now. I think the only consequence of this issue are longer build times/more disk space, due to two copies of GHC, rather than bad build output.
Fixed by #127 (which incorporated #123).
On master (88f1e2d) when setting
useArchiveFilesForTemplateHaskell = true
two versions of GHC are being depended on. Picking an arbitrary package (in this casevector
):Using
nix-tree
to inspect the derivations we find that the first derivation/nix/store/v6hbyn8a5nydw81a9vjabr4qxfj093mr-vector-0.12.3.1.drv
depends on two different GHC derivations:a.
/nix/store/6yvclb4xwmkwg632nmm2mdcaw94vfj7k-ghc-musl-9.2.7.drv
— Immediate Parents (41) b./nix/store/pd3h7k2f9p9290dhfch2wnwkp9714xgk-ghc-musl-9.2.7.drv
— Immediate Parents (4): jailbreak-cabal-1.4.drv, hscolour-1.24.4.drv, Cabal-syntax-3.6.0.0.drv, hscolour-1.24.4.drvWhile the second derivation
/nix/store/ggxx6mgws1vn22l668dsnpl76yx635ri-vector-0.12.3.1.drv
only depends on a.Diffing the derivations for a and b, the only meaningful difference is in the
preConfigure
step:Some observations/thoughts:
enableRelocatedStaticLibs
andenableShared
attributes in the GHC derivation, which is set byuseArchiveFilesForTemplateHaskell
.buildHaskellPackages
, as these parents match things set up inmkDerivationImpl
.buildHaskellPackages
to replace GHC (to avoid depending on 2 versions) https://github.com/nh2/static-haskell-nix/blob/88f1e2d57e3f4cd6d980eb3d8f99d5e60040ad54/survey/default.nix#L1586-L1596.fixGhc
function, which is applied to bothghc
and theghc
inbuildHaskellPackages
, so I'm not sure why it isn't working the same in both places?buildHaskellPackages.ghc
does have the right derivation 🤔