-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
"haskellPackages.extend" and "haskellPackages.override" are incompatible #26561
Comments
I'm not really familiar with |
|
extend
loses the override
function.
@shlevy This needs to be reopened now |
I just ran into this today too. |
It looks like this was changed here but it's not clear why the changes for this issue were reverted. Is there a reason why I'd been using |
@tekul Those changes were reverted because they were much more complicated than the issue really required, and it created a performance regression in the evaluator. I think we just need a tailored solution; i.e. use a custom thing instead of |
Thanks for the info, @ElvishJerricco :-). Could you recommend a workaround? |
@tekul Don't use haskellPackages.override (old: {
overrides = lib.composeExtensions (old.overrides or (_: _: {})) (self: super: {
# ...
});
}) |
I ran into this while overriding Are there any other options? I'm trying to write some generic Nix code and don't want to force my users to rewrite their code to use them more verbose version of An overlay-like feature would be much nicer. |
@pjones I think we should just use a custom callPackage to define haskellPackages. Something adds extend in a simple and compatible way. I'll put up a PR later |
It's getting ever more confusing. #25887 (comment) recommends to use |
@nh2 The problem is that people perceive haskellPackages.override (old: {
overrides = lib.composeExtensions (old.overrides or (_: _: {})) (self: super: {
# ...
});
}) If you use TL;DR: |
This is still an issue. I just ran into it now. |
@ElvishJerricco Still confused by this. It gets me
And indeed so far all uses of Am I missing something? |
My bad, I had a typo, writing
when it should be only 1 pair of |
See NixOS/nixpkgs#26561 (comment) Also use `super` only where it should be used.
Bump. Still confused about which to use, though the gist of it seems to currently be "use override, but you have to manually preserve old overrides". I made an attempt at abstracting the "correct" override pattern, though I'm fairly sure it's wrong in some way. https://gist.github.com/DanBurton/bf79410a9ed639bcd3d66dac58b645d3 |
@DanBurton Here is what I'm using, based on @ElvishJerricco's suggestion earlier in the thread: The syntax of Using this function has fixed a few problems I was having with |
I still use |
I see no reason why we couldn't define |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
Ran into this today. |
- Move overrides for haskellPackages to an overlay based on suggestions from [ElvishJerricco](NixOS/nixpkgs#26561 (comment)) and [NickHu](NixOS/nixpkgs#63500 (comment)) - haskellPackage overrides are now managed in a haskell overlay, allowing them to be more easily shared between different modules, etc - Various Haskell GI packages have been overridden to unbreak taffybar and allow it to build again - Remove unused overlays from overlay imports - Add config.mine.taffybar.package to xmonad.extraPackages
- Move overrides for haskellPackages to an overlay based on suggestions from [ElvishJerricco](NixOS/nixpkgs#26561 (comment)) and [NickHu](NixOS/nixpkgs#63500 (comment)) - haskellPackage overrides are now managed in a haskell overlay, allowing them to be more easily shared between different modules, etc - Various Haskell GI packages have been overridden to unbreak taffybar and allow it to build again - Remove unused overlays from overlay imports - Add config.mine.taffybar.package to xmonad.extraPackages
So what would the patch look like? This issue starts off suggesting that haskellPackages shouldn't make its own I flailed feebly to attempt this, but never managed to succeed. As far as I can tell, whatever I was doing just got overridden, and I ended up back at (Pun not intended!) |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/patching-ghc-for-your-project/9614/1 |
$ echo '(import <nixpkgs> {}).all-cabal-hashes' | nix repl
Welcome to Nix version 2.3.10. Type :? for help.
«derivation /nix/store/dsmwfbmcwj2yl34p98mqbrp9kcnxr4k4-214ceb3bed92d49a0dffc6c2d8d21b1d0bcc7c25.tar.gz.drv»
$ echo '(import <nixpkgs> { overlays = [ (self: super: { all-cabal-hashes = "foo"; }) ]; }).all-cabal-hashes' | nix repl
Welcome to Nix version 2.3.10. Type :? for help.
"foo"
Though, perhaps what I have suggested above does not accomplish the desired effect? |
I marked this as stale due to inactivity. → More info |
If you use
extend
to change stuff like the package set, it will removeoverride
, preventing you from doing things like overriding the GHC used, or theall-cabal-hashes
. Even if it didn't removeoverride
, I'm guessing theoverride
function installed bynixpkgs.callPackage
would operate on the pre-extend
object, thus eliminating any extensions added that way.Fundamentally, I think
nixpkgs.callPackage
just needs to install anextend
function itself, rather than havinghaskellPackages
make its own. It needs to use theself: super:
style so that you can extend the package with overrides arbitrarily many times. If it had this, theoverrides
argument tohaskell-modules/default.nix
wouldn't be necessary, since it would essentially be a strictly worse version ofextend
.The text was updated successfully, but these errors were encountered: