-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
Stack's Nix support has two modes:
- get Stack to auto-generate a
shell.nixshell file based on stack.yaml data. - write the
shell.nixfile manually and point Stack to that.
In the former case, Stack generates a shell file that pulls in whatever version of GHC it sees fit (i.e. something matching the current snapshot). But in the latter case reproducibility can be compromised, because the GHC version used is whatever corresponds to the ghc top-level attribute in Nixpkgs. That version changes regularly. The user can always hardcode a specific version, but best to DRY and let Stack decide, as in (1).
The right way to do this is expect the shell.nix file to express a function. Then Stack can use
$ nix-shell --arg ghc <some-ghc-version-that-stack-chooses>
when entering the shell. This is completely backwards compatible with existing shell.nix files that are not function expressions. In that case the --arg ghc just gets ignored.