static-haskell-nix icon indicating copy to clipboard operation
static-haskell-nix copied to clipboard

Create pkgsWithGhc package set

Open jonathanlking opened this issue 2 years ago • 4 comments

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 avatar Jul 31 '23 22:07 jonathanlking

As always, I welcome feedback on

  • Whether pkgsWithGhc should be exposed/exist at all (should this be merged into the archiveFilesOverlay?)
  • Better names

jonathanlking avatar Jul 31 '23 22:07 jonathanlking

I guess the main question I have is:

  • 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)? That way people who aren't interested in Haskell, but "system" (C) packages with static and shared libs, could use only the lowest level, and that'd be the the easiest candidate for nixpkgs upstreaming.

nh2 avatar Nov 09 '23 19:11 nh2

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 avatar Nov 09 '23 19:11 jonathanlking

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»

jonathanlking avatar Nov 10 '23 00:11 jonathanlking