-
-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I think it should be possible to make stacklock2nix figure out the ghc version is needs automatically.
Currently, the API of stacklock2nix requires you to pass a full package set, like the following (the baseHaskellPkgSet attr):
stacklock2nix/my-example-haskell-lib-easy/flake.nix
Lines 41 to 56 in ac35783
| my-example-haskell-stacklock = final.stacklock2nix { | |
| stackYaml = ./stack.yaml; | |
| # The Haskell package set to use as a base. You should change this | |
| # based on the compiler version from the resolver in your stack.yaml. | |
| baseHaskellPkgSet = final.haskell.packages.ghc924; | |
| # Any additional Haskell package overrides you may want to add. | |
| additionalHaskellPkgSetOverrides = hfinal: hprev: { | |
| # The servant-cassava.cabal file is malformed on GitHub: | |
| # https://github.com/haskell-servant/servant-cassava/pull/29 | |
| servant-cassava = | |
| final.haskell.lib.compose.overrideCabal | |
| { editedCabalFile = null; revision = null; } | |
| hprev.servant-cassava; | |
| }; |
It should be possible for stacklock2nix to figure out the GHC version automatically from the stackage package set, and then use that internally. I imagine an API like the following would be possible:
final.stacklock2nix {
stackYaml = ./stack.yaml;
haskell = final.haskell;
}stacklock2nix would internally look in the resolver in stack.yaml.lock, figure out it uses GHC-9.2.4, translate that to haskell.packages.ghc924, and then just use that.
If a user wanted to use a different package set (like haskell.packages.native-bignum.ghc924), then they could just fall-back to using the baseHaskellPkgSet argument.