ghc.nix
ghc.nix copied to clipboard
More convenient way to enable withIde from flake
Currently the default devShell does not include HLS. I recommend that we either enable it by default or introduce another dev-shell (e.g. with-ide or dev) that does so.
@MangoIV do you have any opinion on how best to do this?
it actually does, see this line: https://github.com/alpmestan/ghc.nix/blob/f324c9aa06680f08a6baeefcef9289c69e606df3/flake.nix#L59
how best to do this
the pain here comes from not being able to be able to pass arguments to flake commands, that's why there's this userSettings attrset.
I agree this is not nice, afaik it's worked on on the nix side of things but I can't estimate when that lands.
fwiw I documented the use of userSettings here:
https://github.com/alpmestan/ghc.nix/blob/f324c9aa06680f08a6baeefcef9289c69e606df3/README.md?plain=1#L145
Perhaps I should highlight this more prominently?
I also thought about a flake template so that people can init a custom flake that takes their settings, but I haven't quite had a deep enough look into it.
another way would be to generate all outputs but that would be quite the hack.
fwiw I documented the use of
userSettingshere:https://github.com/alpmestan/ghc.nix/blob/f324c9aa06680f08a6baeefcef9289c69e606df3/README.md?plain=1#L145
Perhaps I should highlight this more prominently?
The problem with userSettings is that it's not uncommon for a user to have more than one GHC tree, each using a different devShell. Modifying the flake makes this workflow very error-prone. I suppose we could recommend that users instead have one ghc.nix checkout per GHC working tree, although this seems non-ideal.
I agree this is not nice, afaik it's worked on on the nix side of things but I can't estimate when that lands.
Even worse, as far as I'm aware, it's not even clear that there is upstream consensus that the status quo is even problematic (or, rather, that there is a solution that wouldn't do more harm than good). For this reason, I do wonder whether we wouldn't be better off offering devShells for common cases, letting the "special" cases be handled by userSettings.
another way would be to generate all outputs but that would be quite the hack.
I agree; generating all outputs seems unnecessary. I think merely handling the common cases (for some value of "common") would be sufficient.
CCing @Ericson2314 as I know he has thought about this and is quite involved on the nix side of things.
I think merely handling the common cases (for some value of "common") would be sufficient
if John Ericson doesn't know a good solution I can open a corresponding issue as an intermediate solution and also handle that, if you could perhaps tell what's most used in your experience, that would be great.
For the record, I believe the relevant upstream issue is https://github.com/NixOS/nix/issues/5663. This comment from Eelco makes me skeptical that an upstream solution is forthcoming.
@bgamari can you perhaps look whether #172 looks like an intermediate solution for you?