You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
get Stack to auto-generate a shell.nix shell file based on stack.yaml data.
write the shell.nix file 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
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.
The text was updated successfully, but these errors were encountered:
Addresses #2243
The shell file should expect a `{ghc}` argument which
should be passed to the `buildInputs`, so the stack environment
contains the right GHC
If the shell file doesn't define a function, then the ghc passed
by stack is just ignored, but the doc doesn't mention it in
order to encourage this new good practise.
Ok, I actually didn't take into account the current behaviour of haskell.lib.buildStackProject nix function. See NixOS/nixpkgs#15989 PR that should fix it.
So in the meantime I'm reopening the issue
Ok, this has been statued in NixOS/nixpkgs#15989, so I'm closing the issue.
I updated stack's doc accordingly. For now, until the NixOS PR is merged the ghc field will just be ignored if users make their shells using buildStackProject instead of the raw mkDerivation, so nothing breaks.
Stack's Nix support has two modes:
shell.nix
shell file based on stack.yaml data.shell.nix
file 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 usewhen 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.The text was updated successfully, but these errors were encountered: