Skip to content

Commit 498f34b

Browse files
authored
Merge pull request #48 from DeterminateSystems/sync-2.28.3
Sync with upstream 2.28.3
2 parents eaae67b + c92cb4c commit 498f34b

File tree

29 files changed

+148
-105
lines changed

29 files changed

+148
-105
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.28.2
1+
2.28.3

flake.nix

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@
142142
# without "polluting" the top level "`pkgs`" attrset.
143143
# This also has the benefit of providing us with a distinct set of packages
144144
# we can iterate over.
145-
nixComponents =
145+
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
146+
nixComponents2 =
146147
lib.makeScopeWithSplicing'
147148
{
148149
inherit (final) splicePackages;
149-
inherit (final.nixDependencies) newScope;
150+
inherit (final.nixDependencies2) newScope;
150151
}
151152
{
152-
otherSplices = final.generateSplicesForMkScope "nixComponents";
153+
otherSplices = final.generateSplicesForMkScope "nixComponents2";
153154
f = import ./packaging/components.nix {
154155
inherit (final) lib;
155156
inherit officialRelease;
@@ -160,22 +161,23 @@
160161
};
161162

162163
# The dependencies are in their own scope, so that they don't have to be
163-
# in Nixpkgs top level `pkgs` or `nixComponents`.
164-
nixDependencies =
164+
# in Nixpkgs top level `pkgs` or `nixComponents2`.
165+
# The `2` suffix is here because otherwise it interferes with `nixVersions.latest`, which is used in daemon compat tests.
166+
nixDependencies2 =
165167
lib.makeScopeWithSplicing'
166168
{
167169
inherit (final) splicePackages;
168-
inherit (final) newScope; # layered directly on pkgs, unlike nixComponents above
170+
inherit (final) newScope; # layered directly on pkgs, unlike nixComponents2 above
169171
}
170172
{
171-
otherSplices = final.generateSplicesForMkScope "nixDependencies";
173+
otherSplices = final.generateSplicesForMkScope "nixDependencies2";
172174
f = import ./packaging/dependencies.nix {
173175
inherit inputs stdenv;
174176
pkgs = final;
175177
};
176178
};
177179

178-
nix = final.nixComponents.nix-cli;
180+
nix = final.nixComponents2.nix-cli;
179181

180182
# See https://github.com/NixOS/nixpkgs/pull/214409
181183
# Remove when fixed in this flake's nixpkgs
@@ -275,7 +277,7 @@
275277
# memory leaks with detect_leaks=0.
276278
"" = rec {
277279
nixpkgs = nixpkgsFor.${system}.native;
278-
nixComponents = nixpkgs.nixComponents.overrideScope (
280+
nixComponents = nixpkgs.nixComponents2.overrideScope (
279281
nixCompFinal: nixCompPrev: {
280282
mesonComponentOverrides = _finalAttrs: prevAttrs: {
281283
mesonFlags =
@@ -303,7 +305,7 @@
303305
nixpkgsPrefix:
304306
{
305307
nixpkgs,
306-
nixComponents ? nixpkgs.nixComponents,
308+
nixComponents ? nixpkgs.nixComponents2,
307309
}:
308310
flatMapAttrs nixComponents (
309311
pkgName: pkg:
@@ -333,9 +335,9 @@
333335
binaryTarball = self.hydraJobs.binaryTarball.${system};
334336
# TODO probably should be `nix-cli`
335337
nix = self.packages.${system}.nix-everything;
336-
nix-manual = nixpkgsFor.${system}.native.nixComponents.nix-manual;
337-
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-internal-api-docs;
338-
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents.nix-external-api-docs;
338+
nix-manual = nixpkgsFor.${system}.native.nixComponents2.nix-manual;
339+
nix-internal-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-internal-api-docs;
340+
nix-external-api-docs = nixpkgsFor.${system}.native.nixComponents2.nix-external-api-docs;
339341

340342
fallbackPathsNix =
341343
let
@@ -421,15 +423,15 @@
421423
}:
422424
{
423425
# These attributes go right into `packages.<system>`.
424-
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents.${pkgName};
426+
"${pkgName}" = nixpkgsFor.${system}.native.nixComponents2.${pkgName};
425427
}
426428
// lib.optionalAttrs supportsCross (
427429
flatMapAttrs (lib.genAttrs crossSystems (_: { })) (
428430
crossSystem:
429431
{ }:
430432
{
431433
# These attributes go right into `packages.<system>`.
432-
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents.${pkgName};
434+
"${pkgName}-${crossSystem}" = nixpkgsFor.${system}.cross.${crossSystem}.nixComponents2.${pkgName};
433435
}
434436
)
435437
)
@@ -439,7 +441,7 @@
439441
{
440442
# These attributes go right into `packages.<system>`.
441443
"${pkgName}-${stdenvName}" =
442-
nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.nixComponents.${pkgName};
444+
nixpkgsFor.${system}.nativeForStdenv.${stdenvName}.nixComponents2.${pkgName};
443445
}
444446
)
445447
)

maintainers/flake-module.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@
172172
''^src/libfetchers/include/nix/fetchers/tarball\.hh$''
173173
''^src/libfetchers/git\.cc$''
174174
''^src/libfetchers/mercurial\.cc$''
175-
''^src/libflake/flake/config\.cc$''
176-
''^src/libflake/flake/flake\.cc$''
175+
''^src/libflake/config\.cc$''
176+
''^src/libflake/flake\.cc$''
177177
''^src/libflake/include/nix/flake/flake\.hh$''
178-
''^src/libflake/flake/flakeref\.cc$''
178+
''^src/libflake/flakeref\.cc$''
179179
''^src/libflake/include/nix/flake/flakeref\.hh$''
180-
''^src/libflake/flake/lockfile\.cc$''
180+
''^src/libflake/lockfile\.cc$''
181181
''^src/libflake/include/nix/flake/lockfile\.hh$''
182-
''^src/libflake/flake/url-name\.cc$''
182+
''^src/libflake/url-name\.cc$''
183183
''^src/libmain/common-args\.cc$''
184184
''^src/libmain/include/nix/main/common-args\.hh$''
185185
''^src/libmain/loggers\.cc$''

packaging/dev-shell.nix

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
{ pkgs }:
77

8-
pkgs.nixComponents.nix-util.overrideAttrs (
8+
pkgs.nixComponents2.nix-util.overrideAttrs (
99
attrs:
1010

1111
let
12-
stdenv = pkgs.nixDependencies.stdenv;
12+
stdenv = pkgs.nixDependencies2.stdenv;
1313
buildCanExecuteHost = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
1414
modular = devFlake.getSystem stdenv.buildPlatform.system;
1515
transformFlag =
@@ -79,26 +79,26 @@ pkgs.nixComponents.nix-util.overrideAttrs (
7979
};
8080

8181
mesonFlags =
82-
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents.nix-util.mesonFlags)
83-
++ map (transformFlag "libstore") (ignoreCrossFile pkgs.nixComponents.nix-store.mesonFlags)
84-
++ map (transformFlag "libfetchers") (ignoreCrossFile pkgs.nixComponents.nix-fetchers.mesonFlags)
82+
map (transformFlag "libutil") (ignoreCrossFile pkgs.nixComponents2.nix-util.mesonFlags)
83+
++ map (transformFlag "libstore") (ignoreCrossFile pkgs.nixComponents2.nix-store.mesonFlags)
84+
++ map (transformFlag "libfetchers") (ignoreCrossFile pkgs.nixComponents2.nix-fetchers.mesonFlags)
8585
++ lib.optionals havePerl (
86-
map (transformFlag "perl") (ignoreCrossFile pkgs.nixComponents.nix-perl-bindings.mesonFlags)
86+
map (transformFlag "perl") (ignoreCrossFile pkgs.nixComponents2.nix-perl-bindings.mesonFlags)
8787
)
88-
++ map (transformFlag "libexpr") (ignoreCrossFile pkgs.nixComponents.nix-expr.mesonFlags)
89-
++ map (transformFlag "libcmd") (ignoreCrossFile pkgs.nixComponents.nix-cmd.mesonFlags);
88+
++ map (transformFlag "libexpr") (ignoreCrossFile pkgs.nixComponents2.nix-expr.mesonFlags)
89+
++ map (transformFlag "libcmd") (ignoreCrossFile pkgs.nixComponents2.nix-cmd.mesonFlags);
9090

9191
nativeBuildInputs =
9292
attrs.nativeBuildInputs or [ ]
93-
++ pkgs.nixComponents.nix-util.nativeBuildInputs
94-
++ pkgs.nixComponents.nix-store.nativeBuildInputs
95-
++ pkgs.nixComponents.nix-fetchers.nativeBuildInputs
96-
++ pkgs.nixComponents.nix-expr.nativeBuildInputs
97-
++ lib.optionals havePerl pkgs.nixComponents.nix-perl-bindings.nativeBuildInputs
98-
++ lib.optionals buildCanExecuteHost pkgs.nixComponents.nix-manual.externalNativeBuildInputs
99-
++ pkgs.nixComponents.nix-internal-api-docs.nativeBuildInputs
100-
++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs
101-
++ pkgs.nixComponents.nix-functional-tests.externalNativeBuildInputs
93+
++ pkgs.nixComponents2.nix-util.nativeBuildInputs
94+
++ pkgs.nixComponents2.nix-store.nativeBuildInputs
95+
++ pkgs.nixComponents2.nix-fetchers.nativeBuildInputs
96+
++ pkgs.nixComponents2.nix-expr.nativeBuildInputs
97+
++ lib.optionals havePerl pkgs.nixComponents2.nix-perl-bindings.nativeBuildInputs
98+
++ lib.optionals buildCanExecuteHost pkgs.nixComponents2.nix-manual.externalNativeBuildInputs
99+
++ pkgs.nixComponents2.nix-internal-api-docs.nativeBuildInputs
100+
++ pkgs.nixComponents2.nix-external-api-docs.nativeBuildInputs
101+
++ pkgs.nixComponents2.nix-functional-tests.externalNativeBuildInputs
102102
++ lib.optional (
103103
!buildCanExecuteHost
104104
# Hack around https://github.com/nixos/nixpkgs/commit/bf7ad8cfbfa102a90463433e2c5027573b462479
@@ -123,14 +123,14 @@ pkgs.nixComponents.nix-util.overrideAttrs (
123123

124124
buildInputs =
125125
attrs.buildInputs or [ ]
126-
++ pkgs.nixComponents.nix-util.buildInputs
127-
++ pkgs.nixComponents.nix-store.buildInputs
128-
++ pkgs.nixComponents.nix-store-tests.externalBuildInputs
129-
++ pkgs.nixComponents.nix-fetchers.buildInputs
130-
++ pkgs.nixComponents.nix-expr.buildInputs
131-
++ pkgs.nixComponents.nix-expr.externalPropagatedBuildInputs
132-
++ pkgs.nixComponents.nix-cmd.buildInputs
133-
++ lib.optionals havePerl pkgs.nixComponents.nix-perl-bindings.externalBuildInputs
126+
++ pkgs.nixComponents2.nix-util.buildInputs
127+
++ pkgs.nixComponents2.nix-store.buildInputs
128+
++ pkgs.nixComponents2.nix-store-tests.externalBuildInputs
129+
++ pkgs.nixComponents2.nix-fetchers.buildInputs
130+
++ pkgs.nixComponents2.nix-expr.buildInputs
131+
++ pkgs.nixComponents2.nix-expr.externalPropagatedBuildInputs
132+
++ pkgs.nixComponents2.nix-cmd.buildInputs
133+
++ lib.optionals havePerl pkgs.nixComponents2.nix-perl-bindings.externalBuildInputs
134134
++ lib.optional havePerl pkgs.perl;
135135
}
136136
)

packaging/hydra.nix

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ let
1919

2020
testNixVersions =
2121
pkgs: daemon:
22-
pkgs.nixComponents.nix-functional-tests.override {
22+
pkgs.nixComponents2.nix-functional-tests.override {
2323
pname = "nix-daemon-compat-tests";
2424
version = "${pkgs.nix.version}-with-daemon-${daemon.version}";
2525

2626
test-daemon = daemon;
2727
};
2828

29-
# Technically we could just return `pkgs.nixComponents`, but for Hydra it's
29+
# Technically we could just return `pkgs.nixComponents2`, but for Hydra it's
3030
# convention to transpose it, and to transpose it efficiently, we need to
3131
# enumerate them manually, so that we don't evaluate unnecessary package sets.
3232
# See listingIsComplete below.
@@ -85,7 +85,7 @@ in
8585
} (_: null);
8686
actualPkgs = lib.concatMapAttrs (
8787
k: v: if lib.strings.hasPrefix "nix-" k then { ${k} = null; } else { }
88-
) nixpkgsFor.${arbitrarySystem}.native.nixComponents;
88+
) nixpkgsFor.${arbitrarySystem}.native.nixComponents2;
8989
diff = lib.concatStringsSep "\n" (
9090
lib.concatLists (
9191
lib.mapAttrsToList (
@@ -111,15 +111,15 @@ in
111111

112112
# Binary package for various platforms.
113113
build = forAllPackages (
114-
pkgName: forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.${pkgName})
114+
pkgName: forAllSystems (system: nixpkgsFor.${system}.native.nixComponents2.${pkgName})
115115
);
116116

117117
shellInputs = removeAttrs (forAllSystems (
118118
system: self.devShells.${system}.default.inputDerivation
119119
)) [ "i686-linux" ];
120120

121121
# Perl bindings for various platforms.
122-
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents.nix-perl-bindings);
122+
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nixComponents2.nix-perl-bindings);
123123

124124
# Binary tarball for various platforms, containing a Nix store
125125
# with the closure of 'nix' package, and the second half of
@@ -145,13 +145,13 @@ in
145145
# };
146146

147147
# Nix's manual
148-
manual = nixpkgsFor.x86_64-linux.native.nixComponents.nix-manual;
148+
manual = nixpkgsFor.x86_64-linux.native.nixComponents2.nix-manual;
149149

150150
# API docs for Nix's unstable internal C++ interfaces.
151-
internal-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-internal-api-docs;
151+
internal-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents2.nix-internal-api-docs;
152152

153153
# API docs for Nix's C bindings.
154-
external-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents.nix-external-api-docs;
154+
external-api-docs = nixpkgsFor.x86_64-linux.native.nixComponents2.nix-external-api-docs;
155155

156156
# System tests.
157157
tests =

src/libcmd/installables.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void completeFlakeInputAttrPath(
4040
std::string_view prefix)
4141
{
4242
for (auto & flakeRef : flakeRefs) {
43-
auto flake = flake::getFlake(*evalState, flakeRef, true);
43+
auto flake = flake::getFlake(*evalState, flakeRef, fetchers::UseRegistries::All);
4444
for (auto & input : flake.inputs)
4545
if (hasPrefix(input.first, prefix))
4646
completions.add(input.first);

src/libexpr/primops/fetchTree.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void fetchTree(
178178
}
179179

180180
if (!state.settings.pureEval && !input.isDirect())
181-
input = lookupInRegistries(state.store, input).first;
181+
input = lookupInRegistries(state.store, input, fetchers::UseRegistries::Limited).first;
182182

183183
if (state.settings.pureEval && !input.isLocked()) {
184184
if (input.getNarHash())

src/libfetchers/include/nix/fetchers/registry.hh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ void overrideRegistry(
6565
const Input & to,
6666
const Attrs & extraAttrs);
6767

68-
using RegistryFilter = std::function<bool(Registry::RegistryType)>;
68+
enum class UseRegistries : int {
69+
No,
70+
All,
71+
Limited, // global and flag registry only
72+
};
6973

7074
/**
7175
* Rewrite a flakeref using the registries. If `filter` is set, only
@@ -74,6 +78,6 @@ using RegistryFilter = std::function<bool(Registry::RegistryType)>;
7478
std::pair<Input, Attrs> lookupInRegistries(
7579
ref<Store> store,
7680
const Input & input,
77-
const RegistryFilter & filter = {});
81+
UseRegistries useRegistries);
7882

7983
}

src/libfetchers/registry.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ std::shared_ptr<Registry> Registry::read(
1414
const Settings & settings,
1515
const Path & path, RegistryType type)
1616
{
17+
debug("reading registry '%s'", path);
18+
1719
auto registry = std::make_shared<Registry>(settings, type);
1820

1921
if (!pathExists(path))
@@ -179,29 +181,36 @@ Registries getRegistries(const Settings & settings, ref<Store> store)
179181
std::pair<Input, Attrs> lookupInRegistries(
180182
ref<Store> store,
181183
const Input & _input,
182-
const RegistryFilter & filter)
184+
UseRegistries useRegistries)
183185
{
184186
Attrs extraAttrs;
185187
int n = 0;
186188
Input input(_input);
187189

190+
if (useRegistries == UseRegistries::No)
191+
return {input, extraAttrs};
192+
188193
restart:
189194

190195
n++;
191196
if (n > 100) throw Error("cycle detected in flake registry for '%s'", input.to_string());
192197

193198
for (auto & registry : getRegistries(*input.settings, store)) {
194-
if (filter && !filter(registry->type)) continue;
199+
if (useRegistries == UseRegistries::Limited
200+
&& !(registry->type == fetchers::Registry::Flag || registry->type == fetchers::Registry::Global))
201+
continue;
195202
// FIXME: O(n)
196203
for (auto & entry : registry->entries) {
197204
if (entry.exact) {
198205
if (entry.from == input) {
206+
debug("resolved flakeref '%s' against registry %d exactly", input.to_string(), registry->type);
199207
input = entry.to;
200208
extraAttrs = entry.extraAttrs;
201209
goto restart;
202210
}
203211
} else {
204212
if (entry.from.contains(input)) {
213+
debug("resolved flakeref '%s' against registry %d", input.to_string(), registry->type);
205214
input = entry.to.applyOverrides(
206215
!entry.from.getRef() && input.getRef() ? input.getRef() : std::optional<std::string>(),
207216
!entry.from.getRev() && input.getRev() ? input.getRev() : std::optional<Hash>());

0 commit comments

Comments
 (0)