Skip to content

fetch{url,zip,git}: restructure with lib.extendMkDerivation#455994

Merged
philiptaron merged 8 commits intoNixOS:masterfrom
ShamrockLee:fetchurl-extendMkDerivation
Oct 28, 2025
Merged

fetch{url,zip,git}: restructure with lib.extendMkDerivation#455994
philiptaron merged 8 commits intoNixOS:masterfrom
ShamrockLee:fetchurl-extendMkDerivation

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Oct 26, 2025

This PR restructures fetchurl, fetchzip and fetchgit with lib.extendMkDerivation.

This PR doesn't contain overriding fixes required to make finalAttrs and <pkg>.overrideAttrs function without surprises, so I'm not claiming that their fixed-point arguments support are available.

Changed semantics after overriding:

  • fetchurl: The following arguments are now passed down to stdenvNoCC.mkDerivation:
    • recursiveHash
    • netrcPhase
    • netrcImpureEnvVars
  • fetchgit: The following arguments are now passed down to stdenvNoCC.mkDerivation:
    • netrcPhase (already included in postFetch)
    • netrcImpureEnvVars already included in impureEnvVars

The rebuilded packages are all test cases under pkgs.tests.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@ShamrockLee ShamrockLee force-pushed the fetchurl-extendMkDerivation branch from fe3c465 to 71d314e Compare October 26, 2025 20:11
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) labels Oct 26, 2025
@ShamrockLee ShamrockLee force-pushed the fetchurl-extendMkDerivation branch 2 times, most recently from 546c7d4 to b76d5e8 Compare October 26, 2025 20:51
@ShamrockLee
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 455994
Commit: b76d5e818c47fe616d5ca5049d375e09914c0652


x86_64-linux

✅ 49 packages built:
  • tests.fetchFirefoxAddon.simple (tests.fetchFirefoxAddon.overridden-source)
  • tests.fetchFromBitbucket.withEncodedWhitespace
  • tests.fetchFromBitbucket.withEncodedWhitespaceGit
  • tests.fetchFromBitbucket.withoutWhitespace
  • tests.fetchFromGitHub.dumb-http-signed-tag
  • tests.fetchFromGitHub.fetchTags
  • tests.fetchFromGitHub.leave-git
  • tests.fetchFromGitHub.rootDir
  • tests.fetchFromGitHub.simple
  • tests.fetchFromGitHub.sparseCheckout
  • tests.fetchFromGitHub.sparseCheckoutNonConeMode
  • tests.fetchFromGitHub.submodule-deep
  • tests.fetchFromGitHub.submodule-leave-git
  • tests.fetchFromGitHub.submodule-leave-git-deep
  • tests.fetchFromGitHub.submodule-simple
  • tests.fetchPypiLegacy.fetchSimple
  • tests.fetchgit.dumb-http-signed-tag
  • tests.fetchgit.fetchTags
  • tests.fetchgit.leave-git
  • tests.fetchgit.prefetch-git-no-add-path
  • tests.fetchgit.rootDir
  • tests.fetchgit.simple
  • tests.fetchgit.sparseCheckout
  • tests.fetchgit.sparseCheckoutNonConeMode
  • tests.fetchgit.submodule-deep
  • tests.fetchgit.submodule-leave-git
  • tests.fetchgit.submodule-leave-git-deep
  • tests.fetchgit.submodule-simple
  • tests.fetchgit.withGitConfig
  • tests.fetchpatch2.decode
  • tests.fetchpatch2.fileWithApostrophe
  • tests.fetchpatch2.fileWithSpace
  • tests.fetchpatch2.full
  • tests.fetchpatch2.hunks
  • tests.fetchpatch2.relative
  • tests.fetchpatch2.simple
  • tests.fetchtorrent.http-link (tests.fetchtorrent.http-link-transmission)
  • tests.fetchtorrent.http-link-rqbit (tests.fetchtorrent.http-link-rqbit-flattened)
  • tests.fetchtorrent.http-link-rqbit-unflattened
  • tests.fetchtorrent.magnet-link (tests.fetchtorrent.magnet-link-transmission)
  • tests.fetchtorrent.magnet-link-rqbit (tests.fetchtorrent.magnet-link-rqbit-flattened)
  • tests.fetchtorrent.magnet-link-rqbit-unflattened
  • tests.fetchurl.header
  • tests.fetchzip.hiddenDir
  • tests.fetchzip.postFetch
  • tests.fetchzip.simple
  • tests.haskell.cabalSdist.assumptionLocalHasDirectReference
  • tests.haskell.cabalSdist.localHasNoDirectReference
  • tests.testers.runCommand.bork

@ShamrockLee ShamrockLee marked this pull request as ready for review October 26, 2025 21:11
@nix-owners nix-owners bot requested a review from philiptaron October 26, 2025 21:12
Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not at all fussed by including the formatting in the commits that introduce lib.extendMkDerivation and skipping .git-blame-ignore-revs

@philiptaron
Copy link
Contributor

Nice work!

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 27, 2025
@ShamrockLee ShamrockLee force-pushed the fetchurl-extendMkDerivation branch from b76d5e8 to 825b4ef Compare October 27, 2025 16:03
@ShamrockLee
Copy link
Contributor Author

There are some extra rebuilding packages after the name-attribute changes. i'll take a look.

Copy link
Contributor

@philiptaron philiptaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't be able to do intensive testing today, but the code looks immaculate.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 27, 2025

There are some extra rebuilding packages after the name-attribute changes. i'll take a look.

The current implementation of fetchurl precedes pname+version higher than its name attribute, and derived fetchers passes their default name through name without shadowing the pname+version attributes.

Should we keep the original logic, or add another defaultName attribute to hold the default names?

Update:

I choose to observe the original logic with some modification to make pname and version overridable.

fetchurl now always set stdenvNoCC.mkDerivation's name attributes, but consider the following value respectively:

  1. "${finalAttrs.pname}-${finalAttrs.version}" when both finalAttrs.pname and finalAttrs are available and non-null.
  2. "url" when showUrl is true. AFAIK, this is mainly for pkgs.resolveMirrorUrls or for debugging.
  3. name when name is non-null. This is where derived build helpers can insert their own default name.
  4. baseNameOf (toString (lib.head urls_)) otherwise.

@ShamrockLee ShamrockLee force-pushed the fetchurl-extendMkDerivation branch 2 times, most recently from f7a395d to fbf6f38 Compare October 27, 2025 17:35
@philiptaron
Copy link
Contributor

I like your solution to the conundrum.

@ShamrockLee
Copy link
Contributor Author

The extra rebuilds are now gone.

@ShamrockLee ShamrockLee force-pushed the fetchurl-extendMkDerivation branch from fbf6f38 to 1ec0227 Compare October 27, 2025 22:45
@philiptaron philiptaron changed the title fetchurl, fetchzip, fetchgit: restructure with lib.extendMkDerivation fetch{url,zip,git}: restructure with lib.extendMkDerivation Oct 27, 2025
@philiptaron philiptaron changed the title fetch{url,zip,git}: restructure with lib.extendMkDerivation fetch{url,zip,git}: restructure with lib.extendMkDerivation Oct 27, 2025
@ShamrockLee
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 455994
Commit: 1ec0227cc062251c36140ef1e7c37b1cd1b370f1


x86_64-linux

✅ 49 packages built:
  • tests.fetchFirefoxAddon.simple (tests.fetchFirefoxAddon.overridden-source)
  • tests.fetchFromBitbucket.withEncodedWhitespace
  • tests.fetchFromBitbucket.withEncodedWhitespaceGit
  • tests.fetchFromBitbucket.withoutWhitespace
  • tests.fetchFromGitHub.dumb-http-signed-tag
  • tests.fetchFromGitHub.fetchTags
  • tests.fetchFromGitHub.leave-git
  • tests.fetchFromGitHub.rootDir
  • tests.fetchFromGitHub.simple
  • tests.fetchFromGitHub.sparseCheckout
  • tests.fetchFromGitHub.sparseCheckoutNonConeMode
  • tests.fetchFromGitHub.submodule-deep
  • tests.fetchFromGitHub.submodule-leave-git
  • tests.fetchFromGitHub.submodule-leave-git-deep
  • tests.fetchFromGitHub.submodule-simple
  • tests.fetchPypiLegacy.fetchSimple
  • tests.fetchgit.dumb-http-signed-tag
  • tests.fetchgit.fetchTags
  • tests.fetchgit.leave-git
  • tests.fetchgit.prefetch-git-no-add-path
  • tests.fetchgit.rootDir
  • tests.fetchgit.simple
  • tests.fetchgit.sparseCheckout
  • tests.fetchgit.sparseCheckoutNonConeMode
  • tests.fetchgit.submodule-deep
  • tests.fetchgit.submodule-leave-git
  • tests.fetchgit.submodule-leave-git-deep
  • tests.fetchgit.submodule-simple
  • tests.fetchgit.withGitConfig
  • tests.fetchpatch2.decode
  • tests.fetchpatch2.fileWithApostrophe
  • tests.fetchpatch2.fileWithSpace
  • tests.fetchpatch2.full
  • tests.fetchpatch2.hunks
  • tests.fetchpatch2.relative
  • tests.fetchpatch2.simple
  • tests.fetchtorrent.http-link (tests.fetchtorrent.http-link-transmission)
  • tests.fetchtorrent.http-link-rqbit (tests.fetchtorrent.http-link-rqbit-flattened)
  • tests.fetchtorrent.http-link-rqbit-unflattened
  • tests.fetchtorrent.magnet-link (tests.fetchtorrent.magnet-link-transmission)
  • tests.fetchtorrent.magnet-link-rqbit (tests.fetchtorrent.magnet-link-rqbit-flattened)
  • tests.fetchtorrent.magnet-link-rqbit-unflattened
  • tests.fetchurl.header
  • tests.fetchzip.hiddenDir
  • tests.fetchzip.postFetch
  • tests.fetchzip.simple
  • tests.haskell.cabalSdist.assumptionLocalHasDirectReference
  • tests.haskell.cabalSdist.localHasNoDirectReference
  • tests.testers.runCommand.bork

@ShamrockLee
Copy link
Contributor Author

Despite reporting depent packages build successfully, nixpkgs-review complains

error: builder for '/nix/store/a8h8acxd0h0ysbiw8bqpkdvsw408dr2i-review-shell.drv' failed with exit code 126;
       last 1 log lines:
       > /nix/store/jsj1sql9id9c10sxmg7rvq3pj0f1l19b-stdenv-linux/setup: line 847: source: /nix/store/35z955rp7xsx3s635afrcax74xaj6bzf-source-salted-xxmd8yhqp1fz: cannot execute binary file
       For full logs, run:
         nix log /nix/store/a8h8acxd0h0ysbiw8bqpkdvsw408dr2i-review-shell.drv

I'm not entirely sure what is going on.

I also rebuild all the changed test sets (shown in the CI summary) manually, and they all build.

nix build --no-link --print-out-paths -L -f . \
  tests.fetchDebianPatch tests.fetchFirefoxAddon \
  tests.fetchFromGitHub tests.fetchNextcloudApp \
  tests.fetchPypiLegacy  tests.fetchgit tests.fetchpatch \
  tests.fetchpatch2 tests.fetchtorrent tests.fetchurl \
  tests.fetchzip tests.haskell.cabalSdist tests.testers.runCommand

@philiptaron
Copy link
Contributor

There's no issue. This is a nixpkgs-review + buildEnv + stdenv behavior, where derivations which produce a single file are treated as build hooks. It's not your fault. This is good to merge, I think.

@philiptaron philiptaron added this pull request to the merge queue Oct 28, 2025
Merged via the queue into NixOS:master with commit 81f2a11 Oct 28, 2025
65 of 69 checks passed
@ShamrockLee
Copy link
Contributor Author

Now I can confirm that it's a nixpkgs-review issue. The issue is gone after applying changes similar to Mic92/nixpkgs-review#384 (but specify mkShell { packages = [ env ]; } instead of mkShell { packages = env; } and turn off the Python checks.)

@SuperSandro2000
Copy link
Member

Can someone help me updating https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/prefer-remote-fetch/default.nix#L25 to fit this?

I removed the overlay from my config and then was greeted with which probably means some other change is required:

nix-repl> fetchurl.overrideDerivation (_: { abc = ""; })
error:
       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/sandro/src/nixpkgs/lib/customisation.nix:180:29:
          179|         # Change the result of the function call by applying g to it
          180|         overrideResult = g: makeOverridable (mirrorArgs (args: g (f args))) origArgs;
             |                             ^
          181|       in

       … while evaluating a branch condition
         at /home/sandro/src/nixpkgs/lib/customisation.nix:182:7:
          181|       in
          182|       if isAttrs result then
             |       ^
          183|         result

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'drvAttrs' missing
       at /home/sandro/src/nixpkgs/lib/customisation.nix:103:28:
          102|     let
          103|       newDrv = derivation (drv.drvAttrs // (f drv));
             |                            ^
          104|     in

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 30, 2025

@SuperSandro2000

Can someone help me updating https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/prefer-remote-fetch/default.nix#L25 to fit this?

The fetchurl part should work for now, as there's currently no fetchurl (finalAttrs: { }) usage in Nixpkgs. There soon will be, as #456751 is using it. fetchhg (finalAttrs: { }) probably exists in Nixpkgs, though.

The safest way to extend these build helper in an overlay and avoid breaking transient compatibility layer such as #271762's is to handle plain attrset and unfixed set differently. You can write it this way:

self: super:
let
  inherit (self) lib;
  safeExtends =
    newArgs: args:
    if lib.isFunction args then
      lib.extend (_: lib.toFunction newArgs) args
    else
      args // lib.toFunction newArgs args;
{
  fetchurl =
    fpArgs:
    super.fetchurl (safeExtends (args: { preferLocalBuild = args.preferLocalBuild or false; }) fpArgs);
}

Things will get much easier without considering the potential difference between construct args and construct (_: args). The fetchers overridden in the above-linked overlay should all support this:

self: super:
let
  inherit (self) lib;
in
{
  fetchurl =
    fpArgs:
    super.fetchurl (lib.extends
      (finalAttrs: args: { preferLocalBuild = args.preferLocalBuild or false; })
      (lib.toFunction fpArgs));
}
nix-repl> fetchurl.overrideDerivation (_: { abc = ""; })
error:

While lib.makeOverridable does provide result.overrideDerivation and build helpers called with callPackage do have, e.g., fetchurl.overrideDerivation, this doesn't mean they are usable. After all, fetchurl is not a derivation.

@SuperSandro2000
Copy link
Member

I forgot to mention the error I received and will try out the things you suggested.

       … while evaluating derivation 'zstd-1.5.7'
         whose name attribute is located at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:544:13

       … while evaluating attribute 'src' of derivation 'zstd-1.5.7'
         at /home/sandro/src/nixpkgs/pkgs/tools/compression/zstd/default.nix:34:3:
           33|
           34|   src = fetchFromGitHub {
             |   ^
           35|     owner = "facebook";

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/sandro/src/nixpkgs/pkgs/tools/compression/zstd/default.nix:34:9:
           33|
           34|   src = fetchFromGitHub {
             |         ^
           35|     owner = "facebook";

       … from call site
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1009:5:
         1008|     # TODO: Should we add call-time "type" checking like built in?
         1009|     __functor = self: f;
             |     ^
         1010|     __functionArgs = args;

       … while calling anonymous lambda
         at /home/sandro/src/nixpkgs/lib/customisation.nix:161:7:
          160|     mirrorArgs (
          161|       origArgs:
             |       ^
          162|       let

       … while evaluating a branch condition
         at /home/sandro/src/nixpkgs/lib/customisation.nix:182:7:
          181|       in
          182|       if isAttrs result then
             |       ^
          183|         result

       … while calling the 'isAttrs' builtin
         at /home/sandro/src/nixpkgs/lib/customisation.nix:182:10:
          181|       in
          182|       if isAttrs result then
             |          ^
          183|         result

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:163:18:
          162|       let
          163|         result = f origArgs;
             |                  ^
          164|

       … while calling anonymous lambda
         at /home/sandro/src/nixpkgs/pkgs/build-support/fetchgithub/default.nix:9:3:
            8| lib.makeOverridable (
            9|   {
             |   ^
           10|     owner,

       … in the left operand of the update (//) operator
         at /home/sandro/src/nixpkgs/pkgs/build-support/fetchgithub/default.nix:164:3:
          163|
          164|   fetcher fetcherArgs
             |   ^
          165|   // {

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/sandro/src/nixpkgs/pkgs/build-support/fetchgithub/default.nix:164:3:
          163|
          164|   fetcher fetcherArgs
             |   ^
          165|   // {

       … from call site
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1009:5:
         1008|     # TODO: Should we add call-time "type" checking like built in?
         1009|     __functor = self: f;
             |     ^
         1010|     __functionArgs = args;

       … while calling anonymous lambda
         at /home/sandro/src/nixpkgs/lib/customisation.nix:846:9:
          845|       (
          846|         fpargs:
             |         ^
          847|         transformDrv (

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:847:9:
          846|         fpargs:
          847|         transformDrv (
             |         ^
          848|           constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))

       … while calling 'id'
         at /home/sandro/src/nixpkgs/lib/trivial.nix:40:8:
           39|   */
           40|   id = x: x;
             |        ^
           41|

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:848:11:
          847|         transformDrv (
          848|           constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))
             |           ^
          849|         )

       … while calling 'fetchurl'
         at /home/sandro/src/nixpkgs/pkgs/build-support/prefer-remote-fetch/default.nix:25:14:
           24|   fetchsvn = args: super.fetchsvn ({ preferLocalBuild = false; } // args);
           25|   fetchurl = args: super.fetchurl ({ preferLocalBuild = false; } // args);
             |              ^
           26|   mkNugetSource = args: super.mkNugetSource ({ preferLocalBuild = false; } // args);

       … while calling a functor (an attribute set with a '__functor' attribute)
         at /home/sandro/src/nixpkgs/pkgs/build-support/prefer-remote-fetch/default.nix:25:20:
           24|   fetchsvn = args: super.fetchsvn ({ preferLocalBuild = false; } // args);
           25|   fetchurl = args: super.fetchurl ({ preferLocalBuild = false; } // args);
             |                    ^
           26|   mkNugetSource = args: super.mkNugetSource ({ preferLocalBuild = false; } // args);

       … from call site
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1009:5:
         1008|     # TODO: Should we add call-time "type" checking like built in?
         1009|     __functor = self: f;
             |     ^
         1010|     __functionArgs = args;

       … while calling anonymous lambda
         at /home/sandro/src/nixpkgs/lib/customisation.nix:846:9:
          845|       (
          846|         fpargs:
             |         ^
          847|         transformDrv (

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:847:9:
          846|         fpargs:
          847|         transformDrv (
             |         ^
          848|           constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))

       … while calling 'id'
         at /home/sandro/src/nixpkgs/lib/trivial.nix:40:8:
           39|   */
           40|   id = x: x;
             |        ^
           41|

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:848:11:
          847|         transformDrv (
          848|           constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))
             |           ^
          849|         )

       … while calling 'mkDerivation'
         at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:66:18:
           65|   */
           66|   mkDerivation = fnOrAttrs: makeDerivationExtensible (toFunction fnOrAttrs);
             |                  ^
           67|

       … from call site
         at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:66:29:
           65|   */
           66|   mkDerivation = fnOrAttrs: makeDerivationExtensible (toFunction fnOrAttrs);
             |                             ^
           67|

       … while calling 'makeDerivationExtensible'
         at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:77:5:
           76|   makeDerivationExtensible =
           77|     rattrs:
             |     ^
           78|     let

       … from call site
         at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:138:22:
          137|
          138|       finalPackage = mkDerivationSimple overrideAttrs args;
             |                      ^
          139|

       … from call site
         at /home/sandro/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:84:14:
           83|       # An infinite recursion here can be caused by having the attribute names of expression `e` in `.overrideAttrs(finalAttrs: previousAttrs: e)` depend on `finalAttrs`. Only the attribute values of `e` can depend on `finalAttrs`.
           84|       args = rattrs (args // { inherit finalPackage overrideAttrs; });
             |              ^
           85|       #              ^^^^

       … while calling 'extendsWithExclusion'
         at /home/sandro/src/nixpkgs/lib/customisation.nix:830:30:
          829|       extendsWithExclusion =
          830|         excludedNames: g: f: final:
             |                              ^
          831|         let

       … in the right operand of the update (//) operator
         at /home/sandro/src/nixpkgs/lib/customisation.nix:834:47:
          833|         in
          834|         removeAttrs previous excludedNames // g final previous;
             |                                               ^
          835|     in

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:834:47:
          833|         in
          834|         removeAttrs previous excludedNames // g final previous;
             |                                               ^
          835|     in

       … from call site
         at /home/sandro/src/nixpkgs/lib/customisation.nix:848:80:
          847|         transformDrv (
          848|           constructDrv (extendsWithExclusion excludeDrvArgNames extendDrvArgs (toFunction fpargs))
             |                                                                                ^
          849|         )

       … while calling 'toFunction'
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1120:16:
         1119|   */
         1120|   toFunction = v: if isFunction v then v else k: v;
             |                ^
         1121|

       … while evaluating a branch condition
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1120:19:
         1119|   */
         1120|   toFunction = v: if isFunction v then v else k: v;
             |                   ^
         1121|

       … from call site
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1120:22:
         1119|   */
         1120|   toFunction = v: if isFunction v then v else k: v;
             |                      ^
         1121|

       … while calling 'isFunction'
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1043:16:
         1042|   */
         1043|   isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
             |                ^
         1044|

       … in the left operand of the OR (||) operator
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1043:41:
         1042|   */
         1043|   isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
             |                                         ^
         1044|

       … while calling the 'isFunction' builtin
         at /home/sandro/src/nixpkgs/lib/trivial.nix:1043:19:
         1042|   */
         1043|   isFunction = f: builtins.isFunction f || (f ? __functor && isFunction (f.__functor f));
             |                   ^
         1044|

       … in the right operand of the update (//) operator
         at /home/sandro/src/nixpkgs/pkgs/build-support/prefer-remote-fetch/default.nix:25:69:
           24|   fetchsvn = args: super.fetchsvn ({ preferLocalBuild = false; } // args);
           25|   fetchurl = args: super.fetchurl ({ preferLocalBuild = false; } // args);
             |                                                                     ^
           26|   mkNugetSource = args: super.mkNugetSource ({ preferLocalBuild = false; } // args);

       error: expected a set but found a function: «lambda extendsWithExclusion @ /home/sandro/src/nixpkgs/lib/customisation.nix:830:30»

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 30, 2025

That's one is understandable. It can be reproduced simply by { } // (finalAttrs: { }).

By the way, thank you for letting me know that people could wrap build helpers this way in their overlays. This means that we shouldn't rely on the lib.functionArgs fetchgit to exclude fetchgit-related arguments for fetchFromGitHub. (I once considered to do so when implementing #456226, but abandoned this idea before opening that PR.)

@SuperSandro2000
Copy link
Member

I'll tried to fix this in #457086

@ShamrockLee
Copy link
Contributor Author

Sorry for the out-of-tree project breakage caused by this PR. I opened PR #458150 to mitigate them with a compatibility layer. Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants