Repository navigation
prefer-remote-fetch: Fix evaluation for all fetchers and export additional attributes - #475142
Merged
Merged
Conversation
Contributor
|
philiptaron
approved these changes
Jan 5, 2026
philiptaron
left a comment
Contributor
There was a problem hiding this comment.
Appreciate the tests.
Comment on lines
+36
to
+38
| fetchgit = (preferLocal super.fetchgit) // { | ||
| inherit (super.fetchgit) getRevWithTag; | ||
| }; |
Contributor
There was a problem hiding this comment.
This looks fishy to me: I think it's adding the name into the __functor attrset. If it works for you, I think it's fine though.
Contributor
|
I think this obviates my PR #457313 |
1 task done
Contributor
|
Successfully created backport PR for |
| fetchipfs = preferLocal super.fetchipfs; | ||
| fetchrepoproject = preferLocal super.fetchrepoproject; | ||
| fetchs3 = preferLocal super.fetchs3; | ||
| fetchsvn = preferLocal super.fetchsvn; |
Member
There was a problem hiding this comment.
This broke fetchsvn for me:
… while evaluating derivation 'spandsp-0.0.6'
whose name attribute is located at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/make-derivation.nix:541:13
… while evaluating attribute 'nativeBuildInputs' of derivation 'spandsp-0.0.6'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/make-derivation.nix:590:13:
589| depsBuildBuild = elemAt (elemAt dependencies 0) 0;
590| nativeBuildInputs = elemAt (elemAt dependencies 0) 1;
| ^
591| depsBuildTarget = elemAt (elemAt dependencies 0) 2;
… in the condition of the assert statement
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/customisation.nix:429:15:
428| outPath =
429| assert condition;
| ^
430| drv.${outputName}.outPath;
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/make-derivation.nix:835:18:
834| };
835| validity = checkMeta.assertValidity { inherit meta attrs; };
| ^
836|
… while calling 'assertValidity'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:696:5:
695| assertValidity =
696| { meta, attrs }:
| ^
697| let
… while evaluating a branch condition
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:701:5:
700| in
701| if isNull invalid then
| ^
702| if isNull warning then
… while calling the 'isNull' builtin
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:701:8:
700| in
701| if isNull invalid then
| ^
702| if isNull warning then
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:698:17:
697| let
698| invalid = checkValidity attrs;
| ^
699| warning = checkWarnings attrs;
… while calling 'checkValidity'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:451:5:
450| checkValidity =
451| attrs:
| ^
452| # Check meta attribute types first, to make sure it is always called even when there are other issues
… while evaluating a branch condition
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:454:5:
453| # Note that this is not a full type check and functions below still need to by careful about their inputs!
454| if metaInvalid (attrs.meta or { }) then
| ^
455| {
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:454:8:
453| # Note that this is not a full type check and functions below still need to by careful about their inputs!
454| if metaInvalid (attrs.meta or { }) then
| ^
455| {
… while calling anonymous lambda
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:7:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… in the argument of the not operator
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:14:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… while calling the 'all' builtin
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:14:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… while calling anonymous lambda
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:19:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… in the right operand of the AND (&&) operator
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:45:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/check-meta.nix:428:48:
427| if config.checkMeta then
428| meta: !all (attr: metaTypes ? ${attr} && metaTypes'.${attr} meta.${attr}) (attrNames meta)
| ^
429| else
… while calling 'verify'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:96:16:
95| name = "union<${concatStringsSep "," (map (t: t.name) types)}>";
96| verify = v: any (func: func v) funcs;
| ^
97| };
… while calling the 'any' builtin
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:96:19:
95| name = "union<${concatStringsSep "," (map (t: t.name) types)}>";
96| verify = v: any (func: func v) funcs;
| ^
97| };
… while calling anonymous lambda
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:96:24:
95| name = "union<${concatStringsSep "," (map (t: t.name) types)}>";
96| verify = v: any (func: func v) funcs;
| ^
97| };
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:96:30:
95| name = "union<${concatStringsSep "," (map (t: t.name) types)}>";
96| verify = v: any (func: func v) funcs;
| ^
97| };
… while calling anonymous lambda
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:84:43:
83| # listOf<any> can be optimised to just isList
84| if t == self.any then isList else v: isList v && all verify v;
| ^
85| };
… in the left operand of the AND (&&) operator
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:84:55:
83| # listOf<any> can be optimised to just isList
84| if t == self.any then isList else v: isList v && all verify v;
| ^
85| };
… while calling the 'isList' builtin
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/stdenv/generic/meta-types.nix:84:46:
83| # listOf<any> can be optimised to just isList
84| if t == self.any then isList else v: isList v && all verify v;
| ^
85| };
… while evaluating the attribute 'changelog'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/by-name/ne/netpbm/package.nix:132:5:
131| meta = {
132| changelog = "https://sourceforge.net/p/netpbm/code/${src.rev}/tree/advanced/doc/HISTORY";
| ^
133| homepage = "https://netpbm.sourceforge.net/";
… while calling a functor (an attribute set with a '__functor' attribute)
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/by-name/ne/netpbm/package.nix:32:9:
31|
32| src = fetchsvn {
| ^
33| url = "https://svn.code.sf.net/p/netpbm/code/advanced";
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/trivial.nix:1017:5:
1016| # TODO: Should we add call-time "type" checking like built in?
1017| __functor = self: f;
| ^
1018| __functionArgs = args;
… while calling anonymous lambda
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/customisation.nix:880:9:
879| (
880| fpargs:
| ^
881| transformDrv (
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/customisation.nix:881:9:
880| fpargs:
881| transformDrv (
| ^
882| constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))
… while calling 'id'
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/trivial.nix:57:8:
56| */
57| id = x: x;
| ^
58|
… while calling a functor (an attribute set with a '__functor' attribute)
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/customisation.nix:882:11:
881| transformDrv (
882| constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))
| ^
883| )
… from call site
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/trivial.nix:1017:5:
1016| # TODO: Should we add call-time "type" checking like built in?
1017| __functor = self: f;
| ^
1018| __functionArgs = args;
… while evaluating the value passed for the lambda argument
at «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/pkgs/build-support/fetchsvn/default.nix:43:1:
42|
43| {
| ^
44| url,
error: expected a set but found a function: «lambda extendsWithExclusion @ «github:SuperSandro2000/nixpkgs/d2c08b67266740e96efa12a20e3cbf4f3ddee847?narHash=sha256-Cqa2%2BMhtVjob3bncQlNMVAWS/BJSAA%2BDYyUhFZF1%2B78%3D»/lib/customisation.nix:863:30»
I would guess because it did not, yet (?) get the same updates as other by @ShamrockLee
Not sure if we should revert or change it to the newer ways to do things.
In the meantime I just applied this locally:
diff --git a/pkgs/build-support/prefer-remote-fetch/default.nix b/pkgs/build-support/prefer-remote-fetch/default.nix
index c39caf4d6b4d..593866ddee78 100644
--- a/pkgs/build-support/prefer-remote-fetch/default.nix
+++ b/pkgs/build-support/prefer-remote-fetch/default.nix
@@ -41,7 +41,7 @@
fetchipfs = preferLocal super.fetchipfs;
fetchrepoproject = preferLocal super.fetchrepoproject;
fetchs3 = preferLocal super.fetchs3;
- fetchsvn = preferLocal super.fetchsvn;
+ fetchsvn = args: super.fetchsvn ({ preferLocalBuild = false; } // args);
fetchurl = preferLocal super.fetchurl;
mkNugetSource = preferLocal super.mkNugetSource;
}
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.
This fixes valuation error with enabled prefer-remote-fetch overlay.
Fixes #467200.
Things done
Use
extendMkDerivationto override default forpreferLocalBuildon fetchers.Expose additional attributes on
fetchgitAdd some tests
Built on platform:
Tested, as applicable:
passthru.tests.Ran
nixpkgs-reviewon this PR. See nixpkgs-review usage.Tested basic functionality of all binary files, usually in
./result/bin/.Nixpkgs Release Notes
NixOS Release Notes
Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.
Add a 👍 reaction to pull requests you find important.