-
-
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
add .overrideDerivation and .overrideAttrs to packages created with callPackages #18455
Conversation
lib/customisation.nix
Outdated
mkAttrOverridable = name: pkg: pkg // { | ||
override = newArgs: mkAttrOverridable name (f (finalArgs // newArgs)).${name}; | ||
}; | ||
mkAttrOverridable = name: pkg: makeOverridableGeneric (x: x."${name}") f finalArgs; |
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.
It looks like postProcess
is always applied directly to the output of f
in makeOverrideableGeneric
, so why not just pass the composition of f
and x: x."${name}"
to makeOverrideable
here?
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.
my bad, how had I missed that?..
lib/customisation.nix
Outdated
mkAttrOverridable = name: pkg: pkg // { | ||
override = newArgs: mkAttrOverridable name (f (finalArgs // newArgs)).${name}; | ||
}; | ||
mkAttrOverridable = name: pkg: makeOverridable (newArgs: (f newArgs).${name}) finalArgs; |
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.
Can you also rename finalArgs
to origArgs
? I think that is less confusing.
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.
No problem. There are args
, auto
, autoArgs
, finalArgs
and newArgs
in one function! So in any case it is better to follow binding declarations than relying on mnemonics.
ping @edolstra |
Instead we should rather add |
@domenkozar, this doesn't add |
2a1af91
to
bc532ff
Compare
…callPackages`/`callPackagesWith` nix/nixUnstable, tomcatN and postgresqlNN use `callPackages` pattern, they have .override attribute, but lack .overrideDerivation and recent .overrideAttrs. Packages created with `callPackage` have all of those. Because .overrideDerivation function is used in public, without this we can break code when refactoring callPackage -> callPackages.
Rebased to master, added motivation for a change to commit message, changed topic name, tested using |
Motivation for this change
After I've change tomcat to
callPackages
in #18419 , I've noticed thatpkgs.tomcat8.overrideDerivation
attribute is lost. This PR is my (and @aneeshusa) vision on how to restore it.Things done
[x] tested override and overrideDerivation for tomcat
[ ] tested everything else