lib.makeOverridable: preserve constructor override and metadata attributes#461032
Merged
roberth merged 1 commit intoNixOS:masterfrom Dec 22, 2025
Merged
Conversation
Contributor
Author
|
d4eb6bc to
21021ad
Compare
Contributor
Author
|
Test cases added. |
Draft
13 tasks
roberth
approved these changes
Dec 22, 2025
Member
roberth
left a comment
There was a problem hiding this comment.
I despise this function, but until we replace it with a simpler concept, we may as well try and make the most of it.
Member
|
The tests are much appreciated ❤️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The local
lib.makeOverridablefor fetchers (added by PR #158968) drops the metadata attributeslib.extendMkDerivationattaches to the fetchers.This PR fixes
lib.makeOverridableto preserve the additional attributes. when the function to decorate is a callable attribute set.Background
During the pre-
finalAttrsera, PR #158968 useslib.makeOverridableto add a custom overrideroverrideto the result FOD of several fetchers in order to workaround the limitation of<pkg>.overrideAttrs.However,
lib.makeOverridewas initially designed to be used bycallPackageand provide the typical<pkg>.overrideinterface, which doesn't take into account functions that has already been called withcallPackageor callable attribute set containing extra attribuets (e.g., the ones defined withlib.extendMkDerivation).Considering that those custom overriders will stay in Nixpkgs for quite some time,
lib.makeOverridableshould be able to handle those edge cases.Quick validation
pkgs.fetchgit. After this change, thelib.extendMkDerivation-provided metadata attributes (constructDrv,excludeDrvArgNames,extendDrvArgs,transformDrv) will show up.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.