From 745fc66702bfe112e26e683603cef855dc010c3a Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 27 Oct 2025 05:49:58 +0800 Subject: [PATCH 1/3] fetchFromGitHub: prevent user overwriting url and private arguments --- pkgs/build-support/fetchgithub/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index dfe210f32c41..4a99305d0abb 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -112,7 +112,8 @@ lib.makeOverridable ( revWithTag = if tag != null then "refs/tags/${tag}" else rev; fetcherArgs = - ( + passthruAttrs + // ( if useFetchGit then { inherit @@ -152,7 +153,6 @@ lib.makeOverridable ( } ) // privateAttrs - // passthruAttrs // { inherit name; }; From a7023948c060dc4dceba77c1e554ea998c0a53f2 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 27 Oct 2025 23:30:20 +0800 Subject: [PATCH 2/3] fetchgit: take passthru --- pkgs/build-support/fetchgit/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix index 45c7599b1c74..a620f6c09a00 100644 --- a/pkgs/build-support/fetchgit/default.nix +++ b/pkgs/build-support/fetchgit/default.nix @@ -60,6 +60,7 @@ lib.makeOverridable ( # Impure env vars (https://nixos.org/nix/manual/#sec-advanced-attributes) # needed for netrcPhase netrcImpureEnvVars ? [ ], + passthru ? { }, meta ? { }, allowedRequisites ? null, # fetch all tags after tree (useful for git describe) @@ -195,7 +196,8 @@ lib.makeOverridable ( passthru = { gitRepoUrl = url; inherit tag; - }; + } + // passthru; } ) ) From 456dd7cece1e3977712d0c2af01a207514f8c05c Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Mon, 27 Oct 2025 23:23:42 +0800 Subject: [PATCH 3/3] fetchFromGitHub: take and unshadow passthru --- pkgs/build-support/fetchgithub/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 4a99305d0abb..c25c86e6f772 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -22,6 +22,7 @@ lib.makeOverridable ( sparseCheckout ? lib.optional (rootDir != "") rootDir, githubBase ? "github.com", varPrefix ? null, + passthru ? { }, meta ? { }, ... # For hash agility }@args: @@ -125,6 +126,7 @@ lib.makeOverridable ( fetchLFS ; url = gitRepoUrl; + inherit passthru; } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } else @@ -149,7 +151,8 @@ lib.makeOverridable ( passthru = { inherit gitRepoUrl; - }; + } + // passthru; } ) // privateAttrs