haskell-nix
haskell-nix copied to clipboard
Prefer composable approach
The examples use methods that cause issues when trying to extend the package set further. Using the right tools, which are no harder, we can avoid frustration down the line.
- Use overlays instead of overrides. They are the way to go, because they are more powerful and, I'd argue, more consistent: overlays for packages sets, overrides for packages.
-
Avoid
rec
keyword. People get used to it and will use it in overlay definitions, leading to surprises. - Use
haskellPackages.extend
instead of.override { overrides =
. It lets you add more layers of overrides which is more flexible. Attempting the same on the current code replaces the single layer of overrides with the new one, which is unexpected. As a bonus, it is syntactically simpler.
Yeah, I agree with using overlays. I've been using them both at work and also in some personal projects and I'm very happy with them.
I also agree with avoiding rec
(in favor of chaining multiple overlays)
I didn't know about extend
, though. Let me check that out and learn how it works
iirc, extend doesn't play nice with override.
On Mon, Jul 2, 2018, 10:45 AM Gabriel Gonzalez [email protected] wrote:
Yeah, I agree with using overlays. I've been using them both at work and also in some personal projects and I'm very happy with them.
I also agree with avoiding rec (in favor of chaining multiple overlays)
I didn't know about extend, though. Let me check that out and learn how it works
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Gabriel439/haskell-nix/issues/53#issuecomment-401881723, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMT5En73b8nBhArLmwb6_3jkETIivks5uClwsgaJpZM4U-5G0 .
https://github.com/NixOS/nixpkgs/issues/26561
On Mon, Jul 2, 2018, 10:48 AM Spiros Boosalis [email protected] wrote:
iirc, extend doesn't play nice with override.
On Mon, Jul 2, 2018, 10:45 AM Gabriel Gonzalez [email protected] wrote:
Yeah, I agree with using overlays. I've been using them both at work and also in some personal projects and I'm very happy with them.
I also agree with avoiding rec (in favor of chaining multiple overlays)
I didn't know about extend, though. Let me check that out and learn how it works
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Gabriel439/haskell-nix/issues/53#issuecomment-401881723, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNoMT5En73b8nBhArLmwb6_3jkETIivks5uClwsgaJpZM4U-5G0 .
Adding two examples of Haskell overlays which you might find handy:
- https://github.com/sorki/hnix-overlay (quite simple, overlays default
haskellPackages
) - https://github.com/HaskellEmbedded/ivory-tower-nix/ (creates a new package set called
myHaskellPackages
using specifiedcompiler
argument, there's alsonix/env.nix
which disables profiling for the whole set)
I'm still not sure if this is their final form as there's some clutter I would like to refactor. Feedback welcome - I will try to create a PR for this repository with the example when I'm sure about the approach.