-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplifying Nix #5154
Simplifying Nix #5154
Conversation
This `only-tools-nixpkgs` devShell generally paralleled the `cabal-only-tools` devShell, but avoiding haskell.nix. While I’m not a huge fan of haskell.nix, this just created duplication and gave us a shell with a somewhat different environment than the one used by `nix build`, etc. It also didn’t work for everyone. In removing that shell, it also sets the default devShell to be `cabal-only-tools`, which some people were already using to work around issues with the previous default.
There are various benefits to using a Nixpkgs release - more likely that things are cached - easier to update the input without breaking everything This also renames a lot of things in the flake: - `nixpkgs-unstable` to `nixpkgs-release` – partially because it’s not unstable any more, but also because both it and the nixpkgs from haskell.nix unstable, so it didn’t really clarify anything - `nixpkgs` to `nixpkgs-haskellNix` – to make it clear where it comes from - `unstable` to `release-pkgs` – the convention is to use `pkgs` for derivation attrsets, and the source switched from unstable to release - `nixpkgs-packages` to `tool-pkgs` – this holds our build tools, so that seemed clearer than “nixpkgs”
Overlays are for derivations, and this isn’t one. Putting it in an overlay also just gives us more levels of indirection to dig through to figure out where things are coming from.
`cabal-local` no longer triggers rebuilds of GHC, so now we can use the devShell that provides the same environment as our build.
This means those environments will also be cached in CI.
@ceedubs @mitchellwrosen – just to annoy you two, this PR removes Also, if anyone wants to try this out before it’s merged that’d be awesome. |
Hey @sellout this is awesome! I was wondering if the flake could be simplified. I'm using NixOS so let me quickly give it a spin (will edit comment once I've done so) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I have wondered whether this flake could be simplified.
But I was under the impression that a lot of the complexity was due to supporting specific GHC/ormolu/etc versions that didn't necessarily line up with what was in nixpkgs/haskell.nix. Do you know? As long as @aryairani, @mitchellwrosen, and @ChrisPenner are good with the versions being used, then I think we are good.
This does maintain the same versions of everything as before. One of the reasons for the multiple devShells previously was issues with the IOG cache that resulted in GHC having to be rebuilt by devs. That is fixed for the use cases we generally support. I think that keeping the versions in sync between the two devShells was then a source of complication. The removal of the second devShell is reflected in c163375 and 07c7ca4, where you can see is where we got most of the code removal from. It does look like GHC got unpinned, but the version of GHC used by the haskell.nix devShell comes from stack.yaml – it only needed to be included in the flake to ensure that the non-haskell.nix version also matched. There are some real changes here, though. E.g.,
I think that Nix can have good libraries with solid APIs, etc. but it’s not there yet and as a result things start looking complicated quite quickly. I.e., you really gotta justify every line of it. And one benefit of a clear & documented (possibly literate?) flake is that it can also serve as a guide for non-Nix users to follow when setting up their own environment. So things like haskell.nix get hidden away, while version numbers, configuration options, supported platforms, etc. are presented up front. |
Hmm I tried
Looking at CI it seems to also be pulling in Any ideas on what might cause this? |
This is the expected version on trunk. GHC 9.6.5 support hasn’t been merged yet. For these same changes for that GHC, look at #5155. As far as the long build – it didn’t rebuild GHC itself, right? 🤞🏼 (That was an issue we were having before) Soon our cache should have all of the latest hashes cached (after merging this, if not before). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Greg! I don't use the nix builds so it's got Cody's thumbs up it's all good by me!
I think it did given the time and since I recall (and I can't retest it now as https://ci.zw3rk.com is returning a 502), but it's okay; it sounds like a cache propagation issue. Thanks for clarifying regarding the ghc-version 👍 |
this is part of #5142 now |
Overview
This makes a number of changes – they make much more sense if you review commit-by-commit. Here are the highlights:
use flake
should hopefully work for all users, now – no need to specifycabal-only-tools
to get a working environmentThis is some preliminary work to support #5142.
Interesting/controversial decisions
It’s Nix – it’s all controversial.
Loose ends
nix flake show
still wants to build GHC 8.10.7 for some reason, but nothing else seems to trigger that issue.