Skip to content

Commit 0227593

Browse files
committed
fix(nix): tweak and fix nix patch
1 parent e4c44ea commit 0227593

File tree

2 files changed

+57
-5
lines changed

2 files changed

+57
-5
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
From d0a23238294198f6702e13d117f75af89dbeac62 Mon Sep 17 00:00:00 2001
2+
From: Seth Flynn <getchoo@tuta.io>
3+
Date: Tue, 27 May 2025 22:20:53 -0400
4+
Subject: [PATCH] lockFlake(): Allow registry lookups for overridden inputs
5+
6+
Fixes #13144
7+
---
8+
src/libflake/flake.cc | 11 ++++++-----
9+
1 file changed, 6 insertions(+), 5 deletions(-)
10+
11+
diff --git a/src/libflake/flake.cc b/src/libflake/flake.cc
12+
index fc27df8874e30e7937352445602b3844357e018c..24252d710d7a43f0ef6c789d34e4fcfd206d7e02 100644
13+
--- a/src/libflake/flake.cc
14+
+++ b/src/libflake/flake.cc
15+
@@ -570,7 +570,7 @@ LockedFlake lockFlake(
16+
17+
/* Get the input flake, resolve 'path:./...'
18+
flakerefs relative to the parent flake. */
19+
- auto getInputFlake = [&](const FlakeRef & ref)
20+
+ auto getInputFlake = [&](const FlakeRef & ref, const fetchers::UseRegistries useRegistries)
21+
{
22+
if (auto resolvedPath = resolveRelativePath()) {
23+
return readFlake(state, ref, ref, ref, *resolvedPath, inputAttrPath);
24+
@@ -578,7 +578,7 @@ LockedFlake lockFlake(
25+
return getFlake(
26+
state,
27+
ref,
28+
- useRegistriesInputs,
29+
+ useRegistries,
30+
flakeCache,
31+
inputAttrPath);
32+
}
33+
};
34+
@@ -660,7 +660,7 @@ LockedFlake lockFlake(
35+
}
36+
37+
if (mustRefetch) {
38+
- auto inputFlake = getInputFlake(oldLock->lockedRef);
39+
+ auto inputFlake = getInputFlake(oldLock->lockedRef, useRegistriesInputs);
40+
nodePaths.emplace(childNode, inputFlake.path.parent());
41+
computeLocks(inputFlake.inputs, childNode, inputAttrPath, oldLock, followsPrefix,
42+
inputFlake.path, false);
43+
@@ -685,10 +685,11 @@ LockedFlake lockFlake(
44+
nuked the next time we update the lock
45+
file. That is, overrides are sticky unless you
46+
use --no-write-lock-file. */
47+
- auto ref = (input2.ref && explicitCliOverrides.contains(inputAttrPath)) ? *input2.ref : *input.ref;
48+
+ auto inputIsOverride = explicitCliOverrides.contains(inputAttrPath);
49+
+ auto ref = (input2.ref && inputIsOverride) ? *input2.ref : *input.ref;
50+
51+
if (input.isFlake) {
52+
- auto inputFlake = getInputFlake(*input.ref);
53+
+ auto inputFlake = getInputFlake(*input.ref, inputIsOverride ? fetchers::UseRegistries::All : useRegistriesInputs);
54+
55+
auto childNode = make_ref<LockedNode>(
56+
inputFlake.lockedRef,

nixpkgs-config/overlays/mods.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ with prev;
1818
# nixPatched = lixPackageSets.latest.lix;
1919
nixPatched = nixVersions.stable.overrideAttrs ({ patches ? [ ], ... }: {
2020
patches = patches ++ [
21-
(fetchpatch2 {
22-
name = "13284-allow-user-registry-for-flake-override-input.patch";
23-
url = "https://github.com/NixOS/nix/commit/d0a23238294198f6702e13d117f75af89dbeac62.patch?full_index=1";
24-
hash = "sha256-sRhg2vl8OqqiVCP+o/V/JWZpNc9HRHRBiY9RxJUo2uY=";
25-
})
21+
./13284-allow-user-registry-for-flake-override-input.patch
2622
];
2723
});
2824

0 commit comments

Comments
 (0)