-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
Overriding (Haskell) packages repeatedly is surprising and non-modular #25887
Comments
You can do that with
It is not surprising if it is clear what
Theoretically EDIT: let lib = (import <nixpkgs> {}).lib;
hs-0 = (import <nixpkgs> {}).haskellPackages;
hs-2 =
(hs-0.override (oldArgs: { overrides =
lib.composeExtensions
(lib.composeExtensions
(oldArgs.overrides or (self: super: {}))
(self: super: { x = 42; }))
(self: super: { y = super.x; });}));
in hs-2.y This even seems to be the recommended way to do it, please see the discussion linked further down the thread. |
Thanks, I wasn't even aware of |
Is every example in the documentation rewritable with |
FWIW, this was a duplicate of #26561. See there for discussion on how to work around this with |
Is |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: |
Previous approach was too naive relying on my assumption that we can keep overriding Haskell packages. It does not work like that: NixOS/nixpkgs#25887 I had to step back and introduce an interface that puts more task on the call-site. But, at least, it works now.
Issue description
The
.override
attribute doesn't allow you to repeatedly override the set of Haskell packages. This means it's impossible to compose multiple overlays that change the Haskell package set.Steps to reproduce
The following Nix expression fails to evaluate:
But this is surpring, because:
evaluates to
42
as expected. The problem isoverrides
only looks at the initial result. Furtheroverrides
does not update whatoverrides
begins with.This issue is probably not limited to Haskell packaging.
Importance
The new overlays system means that one would expect it to be possible to combine multiple Haskell overlays. I wanted to have an overlay that contained some build fixes & unreleased (but public) Haskell libraries, and another overlay that contained company internal projects. This isn't possible, because as shown above - these overlays don't compose.
The text was updated successfully, but these errors were encountered: