nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

Create pkgsWithGhc package set #118

Closed jonathanlking closed 1 month ago

jonathanlking commented 1 year ago

This moves the GHC configuration/fixing/selection to the start, ensuring that pkgsWithArchiveFiles contains the "final" version of ghc. This is important as some users of the survey are only interested in a copy of GHC and static libraries (e.g. https://github.com/tweag/skyscope/pull/94/files#diff-8cce62c1be86c722f621f909a18b4a5df8eef70b6399b40194894ad9ce09f0abR20), so can depend on just a subset of the patches made.

As a sanity check, we get the same derivation before and after this change for:

nix-repl> pkgs = import ./survey/default.nix { compiler = "ghc962"; }
nix-repl> pkgs.haskellPackages.ghc                                    
«derivation /nix/store/11rnlr5qbk1pxwk4zjyb3xyz8wz2fyx6-ghc-musl-9.6.2.drv»
jonathanlking commented 1 year ago

As always, I welcome feedback on

nh2 commented 9 months ago

I guess the main question I have is:

jonathanlking commented 9 months ago

Wouldn't it make more sense to layer first the pkgsWithArchiveFiles, and then the static-enabled GHC overlay (as in, swap the order from your PR)?

Yes, I agree; Would anyone want a patched version of GHC without the archive files? I don't think so. Therefore it makes sense for the GHC patch to come after.

jonathanlking commented 9 months ago

I've run the sanity check again, and still get:

nix-repl> pkgs = import ./survey/default.nix { compiler = "ghc962"; }

nix-repl> pkgs.haskellPackages.ghc                                    
«derivation /nix/store/11rnlr5qbk1pxwk4zjyb3xyz8wz2fyx6-ghc-musl-9.6.2.drv»

but now get (as expected):

nix-repl> pkgs.pkgsWithArchiveFiles.ghc
«derivation /nix/store/pd3h7k2f9p9290dhfch2wnwkp9714xgk-ghc-musl-9.2.7.drv»