1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00

Merge pull request #13786 from NixOS/mergify/bp/2.28-maintenance/pr-13785

flake: nixpkgs: nixos-unstable -> nixos-25.05-small (backport #13785)
This commit is contained in:
John Ericson 2025-08-18 16:57:02 -04:00 committed by GitHub
commit 265e535650
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 655 additions and 570 deletions

View file

@ -1,2 +1,6 @@
# bulk initial re-formatting with clang-format # bulk initial re-formatting with clang-format
a5264aa46eadb89c055b4d1442e814edb2d4414e # !autorebase ./maintainers/format.sh --until-stable a5264aa46eadb89c055b4d1442e814edb2d4414e # !autorebase ./maintainers/format.sh --until-stable
# clang-format 18 -> clang-format 19
945d9d7264b0dc7d0a8c8edf1cab34f38cd49a7f # !autorebase ./maintainers/format.sh --until-stable
# nixfmt 1.0.0
448bbbe0fd1fbe09cb46a238fec25b220f172122 # !autorebase ./maintainers/format.sh --until-stable

View file

@ -38,8 +38,7 @@ let
] ]
++ extraPkgs; ++ extraPkgs;
users = users = {
{
root = { root = {
uid = 0; uid = 0;
@ -82,8 +81,7 @@ let
}) (lib.lists.range 1 32) }) (lib.lists.range 1 32)
); );
groups = groups = {
{
root.gid = 0; root.gid = 0;
nixbld.gid = 30000; nixbld.gid = 30000;
nobody.gid = 65534; nobody.gid = 65534;

8
flake.lock generated
View file

@ -63,16 +63,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734359947, "lastModified": 1755442223,
"narHash": "sha256-1Noao/H+N8nFB4Beoy8fgwrcOQLVm9o4zKW1ODaqK9E=", "narHash": "sha256-VtMQg02B3kt1oejwwrGn50U9Xbjgzfbb5TV5Wtx8dKI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "48d12d5e70ee91fe8481378e540433a7303dbf6a", "rev": "cd32a774ac52caaa03bcfc9e7591ac8c18617ced",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "release-24.11", "ref": "nixos-25.05-small",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -1,7 +1,7 @@
{ {
description = "The purely functional package manager"; description = "The purely functional package manager";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-24.11"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05-small";
inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2"; inputs.nixpkgs-regression.url = "github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2";
inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446"; inputs.nixpkgs-23-11.url = "github:NixOS/nixpkgs/a62e6edd6d5e1fa0329b8653c801147986f8d446";

View file

@ -148,7 +148,8 @@ let
nativeBuildInputs = [ nativeBuildInputs = [
meson meson
ninja ninja
] ++ prevAttrs.nativeBuildInputs or [ ]; ]
++ prevAttrs.nativeBuildInputs or [ ];
mesonCheckFlags = prevAttrs.mesonCheckFlags or [ ] ++ [ mesonCheckFlags = prevAttrs.mesonCheckFlags or [ ] ++ [
"--print-errorlogs" "--print-errorlogs"
]; ];

View file

@ -46,8 +46,7 @@
}: }:
let let
libs = libs = {
{
inherit inherit
nix-util nix-util
nix-util-c nix-util-c
@ -63,7 +62,8 @@ let
nix-cmd nix-cmd
; ;
} }
// lib.optionalAttrs //
lib.optionalAttrs
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform) (!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
{ {
# Currently fails in static build # Currently fails in static build
@ -125,8 +125,7 @@ stdenv.mkDerivation (finalAttrs: {
*/ */
dontFixup = true; dontFixup = true;
checkInputs = checkInputs = [
[
# Make sure the unit tests have passed # Make sure the unit tests have passed
nix-util-tests.tests.run nix-util-tests.tests.run
nix-store-tests.tests.run nix-store-tests.tests.run
@ -137,8 +136,8 @@ stdenv.mkDerivation (finalAttrs: {
# Make sure the functional tests have passed # Make sure the functional tests have passed
nix-functional-tests nix-functional-tests
] ]
++ lib.optionals ++
(!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform) lib.optionals (!stdenv.hostPlatform.isStatic && stdenv.buildPlatform.canExecute stdenv.hostPlatform)
[ [
# Perl currently fails in static build # Perl currently fails in static build
# TODO: Split out tests into a separate derivation? # TODO: Split out tests into a separate derivation?

View file

@ -505,8 +505,9 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
for (auto & s : ss) { for (auto & s : ss) {
auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(s); auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(s);
result.push_back(make_ref<InstallableAttrPath>( result.push_back(
InstallableAttrPath::parse(state, *this, vFile, std::move(prefix), std::move(extendedOutputsSpec)))); make_ref<InstallableAttrPath>(InstallableAttrPath::parse(
state, *this, vFile, std::move(prefix), std::move(extendedOutputsSpec))));
} }
} else { } else {
@ -521,7 +522,8 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
if (prefix.find('/') != std::string::npos) { if (prefix.find('/') != std::string::npos) {
try { try {
result.push_back(make_ref<InstallableDerivedPath>( result.push_back(
make_ref<InstallableDerivedPath>(
InstallableDerivedPath::parse(store, prefix, extendedOutputsSpec.raw))); InstallableDerivedPath::parse(store, prefix, extendedOutputsSpec.raw)));
continue; continue;
} catch (BadStorePath &) { } catch (BadStorePath &) {
@ -534,7 +536,8 @@ Installables SourceExprCommand::parseInstallables(ref<Store> store, std::vector<
try { try {
auto [flakeRef, fragment] = auto [flakeRef, fragment] =
parseFlakeRefWithFragment(fetchSettings, std::string{prefix}, absPath(getCommandBaseDir())); parseFlakeRefWithFragment(fetchSettings, std::string{prefix}, absPath(getCommandBaseDir()));
result.push_back(make_ref<InstallableFlake>( result.push_back(
make_ref<InstallableFlake>(
this, this,
getEvalState(), getEvalState(),
std::move(flakeRef), std::move(flakeRef),
@ -610,7 +613,8 @@ static void throwBuildErrors(std::vector<KeyedBuildResult> & buildResults, const
StringSet failedPaths; StringSet failedPaths;
for (; failedResult != failed.end(); failedResult++) { for (; failedResult != failed.end(); failedResult++) {
if (!failedResult->errorMsg.empty()) { if (!failedResult->errorMsg.empty()) {
logError(ErrorInfo{ logError(
ErrorInfo{
.level = lvlError, .level = lvlError,
.msg = failedResult->errorMsg, .msg = failedResult->errorMsg,
}); });

View file

@ -53,7 +53,8 @@ mkMesonLibrary (finalAttrs: {
buildInputs = [ buildInputs = [
({ inherit editline readline; }.${readlineFlavor}) ({ inherit editline readline; }.${readlineFlavor})
] ++ lib.optional enableMarkdown lowdown; ]
++ lib.optional enableMarkdown lowdown;
propagatedBuildInputs = [ propagatedBuildInputs = [
nix-util nix-util

View file

@ -650,7 +650,7 @@ ProcessLineResult NixRepl::processLine(std::string line)
for (auto & arg : args) for (auto & arg : args)
arg = "*" + arg + "*"; arg = "*" + arg + "*";
markdown += "**Synopsis:** `builtins." + (std::string)(*doc->name) + "` " + concatStringsSep(" ", args) markdown += "**Synopsis:** `builtins." + (std::string) (*doc->name) + "` " + concatStringsSep(" ", args)
+ "\n\n"; + "\n\n";
} }

View file

@ -223,20 +223,23 @@ INSTANTIATE_TEST_SUITE_P(
#define X4(w, x, y, z) \ #define X4(w, x, y, z) \
TEST_F(TrivialExpressionTest, nestedAttrsetMerge##w##x##y##z) \ TEST_F(TrivialExpressionTest, nestedAttrsetMerge##w##x##y##z) \
{ \ { \
auto v = eval("{ a.b = { c = 1; d = 2; }; } == { " X_EXPAND_IF##w( \ auto v = eval( \
"{ a.b = { c = 1; d = 2; }; } == { " X_EXPAND_IF##w( \
"a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " }"); \ "a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " }"); \
ASSERT_THAT(v, IsTrue()); \ ASSERT_THAT(v, IsTrue()); \
}; \ }; \
TEST_F(TrivialExpressionTest, nestedAttrsetMergeDup##w##x##y##z) \ TEST_F(TrivialExpressionTest, nestedAttrsetMergeDup##w##x##y##z) \
{ \ { \
ASSERT_THROW( \ ASSERT_THROW( \
eval("{ " X_EXPAND_IF##w("a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y( \ eval( \
"{ " X_EXPAND_IF##w("a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y( \
"a", X_EXPAND_IF##z("b", "c = 2;")) " }"), \ "a", X_EXPAND_IF##z("b", "c = 2;")) " }"), \
Error); \ Error); \
}; \ }; \
TEST_F(TrivialExpressionTest, nestedAttrsetMergeLet##w##x##y##z) \ TEST_F(TrivialExpressionTest, nestedAttrsetMergeLet##w##x##y##z) \
{ \ { \
auto v = eval("{ b = { c = 1; d = 2; }; } == (let " X_EXPAND_IF##w( \ auto v = eval( \
"{ b = { c = 1; d = 2; }; } == (let " X_EXPAND_IF##w( \
"a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " in a)"); \ "a", X_EXPAND_IF##x("b", "c = 1;")) " " X_EXPAND_IF##y("a", X_EXPAND_IF##z("b", "d = 2;")) " in a)"); \
ASSERT_THAT(v, IsTrue()); \ ASSERT_THAT(v, IsTrue()); \
}; };

View file

@ -123,13 +123,13 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::FullAttrs)(0, false).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::FullAttrs) (0, false).exec();
AttrId rowId = state->db.getLastInsertedRowId(); AttrId rowId = state->db.getLastInsertedRowId();
assert(rowId); assert(rowId);
for (auto & attr : attrs) for (auto & attr : attrs)
state->insertAttribute.use()(rowId)(symbols[attr])(AttrType::Placeholder)(0, false).exec(); state->insertAttribute.use()(rowId)(symbols[attr])(AttrType::Placeholder) (0, false).exec();
return rowId; return rowId;
}); });
@ -147,10 +147,10 @@ struct AttrDb
ctx.push_back(' '); ctx.push_back(' ');
ctx.append(*p); ctx.append(*p);
} }
state->insertAttributeWithContext.use()(key.first)(symbols[key.second])(AttrType::String)(s) (ctx) state->insertAttributeWithContext.use()(key.first)(symbols[key.second])(AttrType::String) (s) (ctx)
.exec(); .exec();
} else { } else {
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::String)(s).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::String) (s).exec();
} }
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
@ -162,7 +162,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Bool)(b ? 1 : 0).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Bool) (b ? 1 : 0).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });
@ -173,7 +173,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Int)(n).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Int) (n).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });
@ -185,8 +185,8 @@ struct AttrDb
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute state->insertAttribute
.use()(key.first)(symbols[key.second])(AttrType::ListOfStrings)( .use()(key.first)(symbols[key.second])(
dropEmptyInitThenConcatStringsSep("\t", l)) AttrType::ListOfStrings) (dropEmptyInitThenConcatStringsSep("\t", l))
.exec(); .exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
@ -198,7 +198,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Placeholder)(0, false).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Placeholder) (0, false).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });
@ -209,7 +209,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Missing)(0, false).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Missing) (0, false).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });
@ -220,7 +220,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Misc)(0, false).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Misc) (0, false).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });
@ -231,7 +231,7 @@ struct AttrDb
return doSQLite([&]() { return doSQLite([&]() {
auto state(_state->lock()); auto state(_state->lock());
state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Failed)(0, false).exec(); state->insertAttribute.use()(key.first)(symbols[key.second])(AttrType::Failed) (0, false).exec();
return state->db.getLastInsertedRowId(); return state->db.getLastInsertedRowId();
}); });

View file

@ -44,7 +44,8 @@ EvalErrorBuilder<T> & EvalErrorBuilder<T>::withFrame(const Env & env, const Expr
// NOTE: This is abusing side-effects. // NOTE: This is abusing side-effects.
// TODO: check compatibility with nested debugger calls. // TODO: check compatibility with nested debugger calls.
// TODO: What side-effects?? // TODO: What side-effects??
error.state.debugTraces.push_front(DebugTrace{ error.state.debugTraces.push_front(
DebugTrace{
.pos = expr.getPos(), .pos = expr.getPos(),
.expr = expr, .expr = expr,
.env = env, .env = env,

View file

@ -795,7 +795,8 @@ void EvalState::runDebugRepl(const Error * error, const Env & env, const Expr &
printError("%s\n", error->what()); printError("%s\n", error->what());
if (trylevel > 0 && error->info().level != lvlInfo) if (trylevel > 0 && error->info().level != lvlInfo)
printError("This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL printError(
"This exception occurred in a 'tryEval' call. Use " ANSI_GREEN "--ignore-try" ANSI_NORMAL
" to skip these.\n"); " to skip these.\n");
} }

View file

@ -70,13 +70,15 @@ mkMesonLibrary (finalAttrs: {
nix-util nix-util
nix-store nix-store
nix-fetchers nix-fetchers
] ++ finalAttrs.passthru.externalPropagatedBuildInputs; ]
++ finalAttrs.passthru.externalPropagatedBuildInputs;
# Hack for sake of the dev shell # Hack for sake of the dev shell
passthru.externalPropagatedBuildInputs = [ passthru.externalPropagatedBuildInputs = [
boost boost
nlohmann_json nlohmann_json
] ++ lib.optional enableGC boehmgc; ]
++ lib.optional enableGC boehmgc;
mesonFlags = [ mesonFlags = [
(lib.mesonEnable "gc" enableGC) (lib.mesonEnable "gc" enableGC)

View file

@ -68,7 +68,8 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
std::visit( std::visit(
overloaded{ overloaded{
[&](const NixStringContextElem::Built & b) { [&](const NixStringContextElem::Built & b) {
drvs.push_back(DerivedPath::Built{ drvs.push_back(
DerivedPath::Built{
.drvPath = b.drvPath, .drvPath = b.drvPath,
.outputs = OutputsSpec::Names{b.output}, .outputs = OutputsSpec::Names{b.output},
}); });
@ -117,7 +118,8 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
/* Get all the output paths corresponding to the placeholders we had */ /* Get all the output paths corresponding to the placeholders we had */
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) { if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
res.insert_or_assign( res.insert_or_assign(
DownstreamPlaceholder::fromSingleDerivedPathBuilt(SingleDerivedPath::Built{ DownstreamPlaceholder::fromSingleDerivedPathBuilt(
SingleDerivedPath::Built{
.drvPath = drv.drvPath, .drvPath = drv.drvPath,
.output = outputName, .output = outputName,
}) })
@ -297,7 +299,8 @@ static void import(EvalState & state, const PosIdx pos, Value & vPath, Value * v
} }
} }
static RegisterPrimOp primop_scopedImport(PrimOp{ static RegisterPrimOp primop_scopedImport(
PrimOp{
.name = "scopedImport", .arity = 2, .fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) { .name = "scopedImport", .arity = 2, .fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
import(state, pos, *args[1], args[0], v); import(state, pos, *args[1], args[0], v);
}}); }});
@ -806,7 +809,8 @@ static void prim_genericClosure(EvalState & state, const PosIdx pos, Value ** ar
v.mkList(list); v.mkList(list);
} }
static RegisterPrimOp primop_genericClosure(PrimOp{ static RegisterPrimOp primop_genericClosure(
PrimOp{
.name = "__genericClosure", .name = "__genericClosure",
.args = {"attrset"}, .args = {"attrset"},
.arity = 1, .arity = 1,
@ -861,7 +865,7 @@ static RegisterPrimOp primop_genericClosure(PrimOp{
> ``` > ```
)", )",
.fun = prim_genericClosure, .fun = prim_genericClosure,
}); });
static RegisterPrimOp primop_break( static RegisterPrimOp primop_break(
{.name = "break", {.name = "break",
@ -872,7 +876,8 @@ static RegisterPrimOp primop_break(
)", )",
.fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) { .fun = [](EvalState & state, const PosIdx pos, Value ** args, Value & v) {
if (state.canDebug()) { if (state.canDebug()) {
auto error = Error(ErrorInfo{ auto error = Error(
ErrorInfo{
.level = lvlInfo, .level = lvlInfo,
.msg = HintFmt("breakpoint reached"), .msg = HintFmt("breakpoint reached"),
.pos = state.positions[pos], .pos = state.positions[pos],
@ -940,13 +945,14 @@ static void prim_addErrorContext(EvalState & state, const PosIdx pos, Value ** a
} }
} }
static RegisterPrimOp primop_addErrorContext(PrimOp{ static RegisterPrimOp primop_addErrorContext(
PrimOp{
.name = "__addErrorContext", .name = "__addErrorContext",
.arity = 2, .arity = 2,
// The normal trace item is redundant // The normal trace item is redundant
.addTrace = false, .addTrace = false,
.fun = prim_addErrorContext, .fun = prim_addErrorContext,
}); });
static void prim_ceil(EvalState & state, const PosIdx pos, Value ** args, Value & v) static void prim_ceil(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{ {
@ -1656,11 +1662,12 @@ static void derivationStrictInternal(EvalState & state, const std::string & drvN
v.mkAttrs(result); v.mkAttrs(result);
} }
static RegisterPrimOp primop_derivationStrict(PrimOp{ static RegisterPrimOp primop_derivationStrict(
PrimOp{
.name = "derivationStrict", .name = "derivationStrict",
.arity = 1, .arity = 1,
.fun = prim_derivationStrict, .fun = prim_derivationStrict,
}); });
/* Return a placeholder string for the specified output that will be /* Return a placeholder string for the specified output that will be
substituted by the corresponding output path at build time. For substituted by the corresponding output path at build time. For
@ -1898,7 +1905,8 @@ static void prim_readFile(EvalState & state, const PosIdx pos, Value ** args, Va
} }
NixStringContext context; NixStringContext context;
for (auto && p : std::move(refs)) { for (auto && p : std::move(refs)) {
context.insert(NixStringContextElem::Opaque{ context.insert(
NixStringContextElem::Opaque{
.path = std::move((StorePath &&) p), .path = std::move((StorePath &&) p),
}); });
} }
@ -1956,7 +1964,8 @@ static void prim_findFile(EvalState & state, const PosIdx pos, Value ** args, Va
.debugThrow(); .debugThrow();
} }
lookupPath.elements.emplace_back(LookupPath::Elem{ lookupPath.elements.emplace_back(
LookupPath::Elem{
.prefix = LookupPath::Prefix{.s = prefix}, .prefix = LookupPath::Prefix{.s = prefix},
.path = LookupPath::Path{.s = path}, .path = LookupPath::Path{.s = path},
}); });
@ -1968,7 +1977,8 @@ static void prim_findFile(EvalState & state, const PosIdx pos, Value ** args, Va
v.mkPath(state.findFile(lookupPath, path, pos)); v.mkPath(state.findFile(lookupPath, path, pos));
} }
static RegisterPrimOp primop_findFile(PrimOp{ static RegisterPrimOp primop_findFile(
PrimOp{
.name = "__findFile", .name = "__findFile",
.args = {"search-path", "lookup-path"}, .args = {"search-path", "lookup-path"},
.doc = R"( .doc = R"(
@ -2100,7 +2110,7 @@ static RegisterPrimOp primop_findFile(PrimOp{
> makes `<nixpkgs>` refer to a particular branch of the `NixOS/nixpkgs` repository on GitHub. > makes `<nixpkgs>` refer to a particular branch of the `NixOS/nixpkgs` repository on GitHub.
)", )",
.fun = prim_findFile, .fun = prim_findFile,
}); });
/* Return the cryptographic hash of a file in base-16. */ /* Return the cryptographic hash of a file in base-16. */
static void prim_hashFile(EvalState & state, const PosIdx pos, Value ** args, Value & v) static void prim_hashFile(EvalState & state, const PosIdx pos, Value ** args, Value & v)
@ -2871,11 +2881,12 @@ static void prim_unsafeGetAttrPos(EvalState & state, const PosIdx pos, Value **
state.mkPos(v, i->pos); state.mkPos(v, i->pos);
} }
static RegisterPrimOp primop_unsafeGetAttrPos(PrimOp{ static RegisterPrimOp primop_unsafeGetAttrPos(
PrimOp{
.name = "__unsafeGetAttrPos", .name = "__unsafeGetAttrPos",
.arity = 2, .arity = 2,
.fun = prim_unsafeGetAttrPos, .fun = prim_unsafeGetAttrPos,
}); });
// access to exact position information (ie, line and colum numbers) is deferred // access to exact position information (ie, line and colum numbers) is deferred
// due to the cost associated with calculating that information and how rarely // due to the cost associated with calculating that information and how rarely

View file

@ -276,7 +276,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
if (auto attr = i.value->attrs()->get(sPath)) { if (auto attr = i.value->attrs()->get(sPath)) {
if (state.forceBool(*attr->value, attr->pos, "while evaluating the `path` attribute of a string context")) if (state.forceBool(*attr->value, attr->pos, "while evaluating the `path` attribute of a string context"))
context.emplace(NixStringContextElem::Opaque{ context.emplace(
NixStringContextElem::Opaque{
.path = namePath, .path = namePath,
}); });
} }
@ -291,7 +292,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
.atPos(i.pos) .atPos(i.pos)
.debugThrow(); .debugThrow();
} }
context.emplace(NixStringContextElem::DrvDeep{ context.emplace(
NixStringContextElem::DrvDeep{
.drvPath = namePath, .drvPath = namePath,
}); });
} }
@ -309,7 +311,8 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
for (auto elem : attr->value->listItems()) { for (auto elem : attr->value->listItems()) {
auto outputName = auto outputName =
state.forceStringNoCtx(*elem, attr->pos, "while evaluating an output name within a string context"); state.forceStringNoCtx(*elem, attr->pos, "while evaluating an output name within a string context");
context.emplace(NixStringContextElem::Built{ context.emplace(
NixStringContextElem::Built{
.drvPath = makeConstantStorePathRef(namePath), .drvPath = makeConstantStorePathRef(namePath),
.output = std::string{outputName}, .output = std::string{outputName},
}); });

View file

@ -44,7 +44,8 @@ static void downloadToSink(
static std::string getLfsApiToken(const ParsedURL & url) static std::string getLfsApiToken(const ParsedURL & url)
{ {
auto [status, output] = runProgram(RunOptions{ auto [status, output] = runProgram(
RunOptions{
.program = "ssh", .program = "ssh",
.args = {*url.authority, "git-lfs-authenticate", url.path, "download"}, .args = {*url.authority, "git-lfs-authenticate", url.path, "download"},
}); });

View file

@ -389,7 +389,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
continue; continue;
std::string key2(key, 0, key.size() - 5); std::string key2(key, 0, key.size() - 5);
auto path = CanonPath(value); auto path = CanonPath(value);
result.push_back(Submodule{ result.push_back(
Submodule{
.path = path, .path = path,
.url = entries[key2 + ".url"], .url = entries[key2 + ".url"],
.branch = entries[key2 + ".branch"], .branch = entries[key2 + ".branch"],
@ -533,7 +534,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
append(gitArgs, {"--depth", "1"}); append(gitArgs, {"--depth", "1"});
append(gitArgs, {std::string("--"), url, refspec}); append(gitArgs, {std::string("--"), url, refspec});
runProgram(RunOptions{ runProgram(
RunOptions{
.program = "git", .program = "git",
.lookupPath = true, .lookupPath = true,
// FIXME: git stderr messes up our progress indicator, so // FIXME: git stderr messes up our progress indicator, so
@ -566,7 +568,8 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
writeFile(allowedSignersFile, allowedSigners); writeFile(allowedSignersFile, allowedSigners);
// Run verification command // Run verification command
auto [status, output] = runProgram(RunOptions{ auto [status, output] = runProgram(
RunOptions{
.program = "git", .program = "git",
.args = .args =
{"-c", {"-c",

View file

@ -56,7 +56,8 @@ Path getCachePath(std::string_view key, bool shallow)
// ... // ...
std::optional<std::string> readHead(const Path & path) std::optional<std::string> readHead(const Path & path)
{ {
auto [status, output] = runProgram(RunOptions{ auto [status, output] = runProgram(
RunOptions{
.program = "git", .program = "git",
// FIXME: use 'HEAD' to avoid returning all refs // FIXME: use 'HEAD' to avoid returning all refs
.args = {"ls-remote", "--symref", path}, .args = {"ls-remote", "--symref", path},
@ -325,7 +326,8 @@ struct GitInputScheme : InputScheme
writeFile(*repoPath / path.rel(), contents); writeFile(*repoPath / path.rel(), contents);
auto result = runProgram(RunOptions{ auto result = runProgram(
RunOptions{
.program = "git", .program = "git",
.args = .args =
{"-C", {"-C",

View file

@ -35,7 +35,8 @@ std::shared_ptr<Registry> Registry::read(const Settings & settings, const Path &
toAttrs.erase(j); toAttrs.erase(j);
} }
auto exact = i.find("exact"); auto exact = i.find("exact");
registry->entries.push_back(Entry{ registry->entries.push_back(
Entry{
.from = Input::fromAttrs(settings, jsonToAttrs(i["from"])), .from = Input::fromAttrs(settings, jsonToAttrs(i["from"])),
.to = Input::fromAttrs(settings, std::move(toAttrs)), .to = Input::fromAttrs(settings, std::move(toAttrs)),
.extraAttrs = extraAttrs, .extraAttrs = extraAttrs,

View file

@ -14,7 +14,8 @@ Gen<OutputsSpec> Arbitrary<OutputsSpec>::arbitrary()
return gen::just((OutputsSpec) OutputsSpec::All{}); return gen::just((OutputsSpec) OutputsSpec::All{});
case 1: case 1:
return gen::map( return gen::map(
gen::nonEmpty(gen::container<StringSet>( gen::nonEmpty(
gen::container<StringSet>(
gen::map(gen::arbitrary<StorePathName>(), [](StorePathName n) { return n.name; }))), gen::map(gen::arbitrary<StorePathName>(), [](StorePathName n) { return n.name; }))),
[](StringSet names) { return (OutputsSpec) OutputsSpec::Names{names}; }); [](StringSet names) { return (OutputsSpec) OutputsSpec::Names{names}; });
default: default:

View file

@ -82,13 +82,15 @@ VERSIONED_CHARACTERIZATION_TEST(
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"}, .path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo"},
}, },
DerivedPath::Built{ DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{ .drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}), }),
.outputs = OutputsSpec::All{}, .outputs = OutputsSpec::All{},
}, },
DerivedPath::Built{ DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{ .drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}), }),
.outputs = OutputsSpec::Names{"x", "y"}, .outputs = OutputsSpec::Names{"x", "y"},
@ -108,13 +110,15 @@ VERSIONED_CHARACTERIZATION_TEST(
.path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"}, .path = StorePath{"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-foo.drv"},
}, },
DerivedPath::Built{ DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{ .drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}), }),
.outputs = OutputsSpec::All{}, .outputs = OutputsSpec::All{},
}, },
DerivedPath::Built{ DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{ .drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}), }),
.outputs = OutputsSpec::Names{"x", "y"}, .outputs = OutputsSpec::Names{"x", "y"},
@ -369,7 +373,8 @@ VERSIONED_CHARACTERIZATION_TEST(WorkerProtoTest, keyedBuildResult_1_29, "keyed-b
}, },
/* .path = */ /* .path = */
DerivedPath::Built{ DerivedPath::Built{
.drvPath = makeConstantStorePathRef(StorePath{ .drvPath = makeConstantStorePathRef(
StorePath{
"g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv", "g1w7hy3qg1w7hy3qg1w7hy3qg1w7hy3q-bar.drv",
}), }),
.outputs = OutputsSpec::Names{"out"}, .outputs = OutputsSpec::Names{"out"},

View file

@ -1456,7 +1456,8 @@ std::pair<bool, SingleDrvOutputs> DerivationGoal::checkPathValidity()
// derivation, and the output path is valid, but we don't have // derivation, and the output path is valid, but we don't have
// its realisation stored (probably because it has been built // its realisation stored (probably because it has been built
// without the `ca-derivations` experimental flag). // without the `ca-derivations` experimental flag).
worker.store.registerDrvOutput(Realisation{ worker.store.registerDrvOutput(
Realisation{
drvOutput, drvOutput,
info.known->path, info.known->path,
}); });
@ -1551,7 +1552,8 @@ void DerivationGoal::waiteeDone(GoalPtr waitee, ExitCode result)
auto & outputs = nodeP->value; auto & outputs = nodeP->value;
for (auto & outputName : outputs) { for (auto & outputName : outputs) {
auto buildResult = dg->getBuildResult(DerivedPath::Built{ auto buildResult = dg->getBuildResult(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(dg->drvPath), .drvPath = makeConstantStorePathRef(dg->drvPath),
.outputs = OutputsSpec::Names{outputName}, .outputs = OutputsSpec::Names{outputName},
}); });

View file

@ -68,7 +68,8 @@ std::vector<KeyedBuildResult> Store::buildPathsWithResults(
results.reserve(state.size()); results.reserve(state.size());
for (auto & [req, goalPtr] : state) for (auto & [req, goalPtr] : state)
results.emplace_back(KeyedBuildResult{ results.emplace_back(
KeyedBuildResult{
goalPtr->getBuildResult(req), goalPtr->getBuildResult(req),
/* .path = */ req, /* .path = */ req,
}); });
@ -88,7 +89,8 @@ BuildResult Store::buildDerivation(const StorePath & drvPath, const BasicDerivat
try { try {
worker.run(Goals{goal}); worker.run(Goals{goal});
return goal->getBuildResult(DerivedPath::Built{ return goal->getBuildResult(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(drvPath), .drvPath = makeConstantStorePathRef(drvPath),
.outputs = OutputsSpec::All{}, .outputs = OutputsSpec::All{},
}); });

View file

@ -279,7 +279,8 @@ void Worker::run(const Goals & _topGoals)
for (auto & i : _topGoals) { for (auto & i : _topGoals) {
topGoals.insert(i); topGoals.insert(i);
if (auto goal = dynamic_cast<DerivationGoal *>(i.get())) { if (auto goal = dynamic_cast<DerivationGoal *>(i.get())) {
topPaths.push_back(DerivedPath::Built{ topPaths.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(goal->drvPath), .drvPath = makeConstantStorePathRef(goal->drvPath),
.outputs = goal->wantedOutputs, .outputs = goal->wantedOutputs,
}); });

View file

@ -39,7 +39,8 @@ LegacySSHStore::LegacySSHStore(std::string_view scheme, std::string_view host, c
, CommonSSHStoreConfig(scheme, host, params) , CommonSSHStoreConfig(scheme, host, params)
, LegacySSHStoreConfig(scheme, host, params) , LegacySSHStoreConfig(scheme, host, params)
, Store(params) , Store(params)
, connections(make_ref<Pool<Connection>>( , connections(
make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections), std::max(1, (int) maxConnections),
[this]() { return openConnection(); }, [this]() { return openConnection(); },
[](const ref<Connection> & r) { return r->good; })) [](const ref<Connection> & r) { return r->good; }))

View file

@ -15,7 +15,8 @@ Machine::Machine(
decltype(supportedFeatures) supportedFeatures, decltype(supportedFeatures) supportedFeatures,
decltype(mandatoryFeatures) mandatoryFeatures, decltype(mandatoryFeatures) mandatoryFeatures,
decltype(sshPublicHostKey) sshPublicHostKey) decltype(sshPublicHostKey) sshPublicHostKey)
: storeUri(StoreReference::parse( : storeUri(
StoreReference::parse(
// Backwards compatibility: if the URI is schemeless, is not a path, // Backwards compatibility: if the URI is schemeless, is not a path,
// and is not one of the special store connection words, prepend // and is not one of the special store connection words, prepend
// ssh://. // ssh://.
@ -171,7 +172,8 @@ static Machine parseBuilderLine(const std::set<std::string> & defaultSystems, co
// TODO use designated initializers, once C++ supports those with // TODO use designated initializers, once C++ supports those with
// custom constructors. // custom constructors.
return {// `storeUri` return {
// `storeUri`
tokens[0], tokens[0],
// `systemTypes` // `systemTypes`
isSet(1) ? tokenizeString<std::set<std::string>>(tokens[1], ",") : defaultSystems, isSet(1) ? tokenizeString<std::set<std::string>>(tokens[1], ",") : defaultSystems,

View file

@ -58,8 +58,7 @@ mkMesonLibrary (finalAttrs: {
nativeBuildInputs = lib.optional embeddedSandboxShell unixtools.hexdump; nativeBuildInputs = lib.optional embeddedSandboxShell unixtools.hexdump;
buildInputs = buildInputs = [
[
boost boost
curl curl
sqlite sqlite
@ -74,8 +73,7 @@ mkMesonLibrary (finalAttrs: {
nlohmann_json nlohmann_json
]; ];
mesonFlags = mesonFlags = [
[
(lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux) (lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux)
(lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell) (lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell)
] ]

View file

@ -27,7 +27,8 @@ namespace nix {
RemoteStore::RemoteStore(const Params & params) RemoteStore::RemoteStore(const Params & params)
: RemoteStoreConfig(params) : RemoteStoreConfig(params)
, Store(params) , Store(params)
, connections(make_ref<Pool<Connection>>( , connections(
make_ref<Pool<Connection>>(
std::max(1, (int) maxConnections), std::max(1, (int) maxConnections),
[this]() { [this]() {
auto conn = openConnectionWrapper(); auto conn = openConnectionWrapper();
@ -655,7 +656,8 @@ std::vector<KeyedBuildResult> RemoteStore::buildPathsWithResults(
std::visit( std::visit(
overloaded{ overloaded{
[&](const DerivedPath::Opaque & bo) { [&](const DerivedPath::Opaque & bo) {
results.push_back(KeyedBuildResult{ results.push_back(
KeyedBuildResult{
{ {
.status = BuildResult::Substituted, .status = BuildResult::Substituted,
}, },

View file

@ -93,8 +93,10 @@ static void initAWS()
S3Helper::S3Helper( S3Helper::S3Helper(
const std::string & profile, const std::string & region, const std::string & scheme, const std::string & endpoint) const std::string & profile, const std::string & region, const std::string & scheme, const std::string & endpoint)
: config(makeConfig(region, scheme, endpoint)) : config(makeConfig(region, scheme, endpoint))
, client(make_ref<Aws::S3::S3Client>( , client(
profile == "" ? std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>( make_ref<Aws::S3::S3Client>(
profile == ""
? std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>(
std::make_shared<Aws::Auth::DefaultAWSCredentialsProviderChain>()) std::make_shared<Aws::Auth::DefaultAWSCredentialsProviderChain>())
: std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>( : std::dynamic_pointer_cast<Aws::Auth::AWSCredentialsProvider>(
std::make_shared<Aws::Auth::ProfileConfigFileAWSCredentialsProvider>(profile.c_str())), std::make_shared<Aws::Auth::ProfileConfigFileAWSCredentialsProvider>(profile.c_str())),

View file

@ -88,7 +88,8 @@ void handleDiffHook(
if (diffHookOpt && settings.runDiffHook) { if (diffHookOpt && settings.runDiffHook) {
auto & diffHook = *diffHookOpt; auto & diffHook = *diffHookOpt;
try { try {
auto diffRes = runProgram(RunOptions{ auto diffRes = runProgram(
RunOptions{
.program = diffHook, .program = diffHook,
.lookupPath = true, .lookupPath = true,
.args = {tryA, tryB, drvPath, tmpDir}, .args = {tryA, tryB, drvPath, tmpDir},
@ -2715,7 +2716,8 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
std::filesystem::rename(tmpOutput, actualPath); std::filesystem::rename(tmpOutput, actualPath);
auto newInfo0 = newInfoFromCA(DerivationOutput::CAFloating{ auto newInfo0 = newInfoFromCA(
DerivationOutput::CAFloating{
.method = dof.ca.method, .method = dof.ca.method,
.hashAlgo = wanted.algo, .hashAlgo = wanted.algo,
}); });
@ -2754,7 +2756,8 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
}, },
[&](const DerivationOutput::Impure & doi) { [&](const DerivationOutput::Impure & doi) {
return newInfoFromCA(DerivationOutput::CAFloating{ return newInfoFromCA(
DerivationOutput::CAFloating{
.method = doi.method, .method = doi.method,
.hashAlgo = doi.hashAlgo, .hashAlgo = doi.hashAlgo,
}); });

View file

@ -314,7 +314,8 @@ TEST(Config, applyConfigFailsOnMissingIncludes)
Setting<std::string> setting{&config, "", "name-of-the-setting", "description"}; Setting<std::string> setting{&config, "", "name-of-the-setting", "description"};
ASSERT_THROW( ASSERT_THROW(
config.applyConfig("name-of-the-setting = value-from-file\n" config.applyConfig(
"name-of-the-setting = value-from-file\n"
"# name-of-the-setting = foo\n" "# name-of-the-setting = foo\n"
"include /nix/store/does/not/exist.nix"), "include /nix/store/does/not/exist.nix"),
Error); Error);

View file

@ -31,7 +31,8 @@ TEST(to_json, vectorOfOptionalInts)
TEST(to_json, optionalVectorOfInts) TEST(to_json, optionalVectorOfInts)
{ {
std::optional<std::vector<int>> val = std::make_optional(std::vector<int>{ std::optional<std::vector<int>> val = std::make_optional(
std::vector<int>{
-420, -420,
420, 420,
}); });

View file

@ -50,7 +50,8 @@ mkMesonLibrary (finalAttrs: {
libblake3 libblake3
libsodium libsodium
openssl openssl
] ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid; ]
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid;
propagatedBuildInputs = [ propagatedBuildInputs = [
boost boost

View file

@ -41,7 +41,8 @@ Suggestions Suggestions::bestMatches(const std::set<std::string> & allMatches, s
{ {
std::set<Suggestion> res; std::set<Suggestion> res;
for (const auto & possibleMatch : allMatches) { for (const auto & possibleMatch : allMatches) {
res.insert(Suggestion{ res.insert(
Suggestion{
.distance = levenshteinDistance(query, possibleMatch), .distance = levenshteinDistance(query, possibleMatch),
.suggestion = possibleMatch, .suggestion = possibleMatch,
}); });

View file

@ -253,8 +253,13 @@ pid_t startProcess(std::function<void()> fun, const ProcessOptions & options)
std::string runProgram( std::string runProgram(
Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive) Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive)
{ {
auto res = runProgram(RunOptions{ auto res = runProgram(
.program = program, .lookupPath = lookupPath, .args = args, .input = input, .isInteractive = isInteractive}); RunOptions{
.program = program,
.lookupPath = lookupPath,
.args = args,
.input = input,
.isInteractive = isInteractive});
if (!statusOk(res.first)) if (!statusOk(res.first))
throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first)); throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first));

View file

@ -84,8 +84,13 @@ int Pid::wait()
std::string runProgram( std::string runProgram(
Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive) Path program, bool lookupPath, const Strings & args, const std::optional<std::string> & input, bool isInteractive)
{ {
auto res = runProgram(RunOptions{ auto res = runProgram(
.program = program, .lookupPath = lookupPath, .args = args, .input = input, .isInteractive = isInteractive}); RunOptions{
.program = program,
.lookupPath = lookupPath,
.args = args,
.input = input,
.isInteractive = isInteractive});
if (!statusOk(res.first)) if (!statusOk(res.first))
throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first)); throw ExecError(res.first, "program '%1%' %2%", program, statusToString(res.first));

View file

@ -480,7 +480,8 @@ static void main_nix_build(int argc, char ** argv)
throw Error("the 'bashInteractive' attribute in <nixpkgs> did not evaluate to a derivation"); throw Error("the 'bashInteractive' attribute in <nixpkgs> did not evaluate to a derivation");
auto bashDrv = drv->requireDrvPath(); auto bashDrv = drv->requireDrvPath();
pathsToBuild.push_back(DerivedPath::Built{ pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(bashDrv), .drvPath = makeConstantStorePathRef(bashDrv),
.outputs = OutputsSpec::Names{"out"}, .outputs = OutputsSpec::Names{"out"},
}); });
@ -499,7 +500,8 @@ static void main_nix_build(int argc, char ** argv)
accumDerivedPath = [&](ref<SingleDerivedPath> inputDrv, accumDerivedPath = [&](ref<SingleDerivedPath> inputDrv,
const DerivedPathMap<StringSet>::ChildNode & inputNode) { const DerivedPathMap<StringSet>::ChildNode & inputNode) {
if (!inputNode.value.empty()) if (!inputNode.value.empty())
pathsToBuild.push_back(DerivedPath::Built{ pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = inputDrv, .drvPath = inputDrv,
.outputs = OutputsSpec::Names{inputNode.value}, .outputs = OutputsSpec::Names{inputNode.value},
}); });
@ -687,7 +689,8 @@ static void main_nix_build(int argc, char ** argv)
if (outputName == "") if (outputName == "")
throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath)); throw Error("derivation '%s' lacks an 'outputName' attribute", store->printStorePath(drvPath));
pathsToBuild.push_back(DerivedPath::Built{ pathsToBuild.push_back(
DerivedPath::Built{
.drvPath = makeConstantStorePathRef(drvPath), .drvPath = makeConstantStorePathRef(drvPath),
.outputs = OutputsSpec::Names{outputName}, .outputs = OutputsSpec::Names{outputName},
}); });

View file

@ -467,7 +467,8 @@ static void printMissing(EvalState & state, PackageInfos & elems)
}; };
targets.emplace_back(std::move(path)); targets.emplace_back(std::move(path));
} else } else
targets.emplace_back(DerivedPath::Opaque{ targets.emplace_back(
DerivedPath::Opaque{
.path = i.queryOutPath(), .path = i.queryOutPath(),
}); });
@ -1108,7 +1109,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs)
attrs["substitutable"] = hasSubs ? "1" : "0"; attrs["substitutable"] = hasSubs ? "1" : "0";
} else } else
columns.push_back( columns.push_back(
(std::string)(isInstalled ? "I" : "-") + (isValid ? "P" : "-") + (hasSubs ? "S" : "-")); (std::string) (isInstalled ? "I" : "-") + (isValid ? "P" : "-") + (hasSubs ? "S" : "-"));
} }
if (xmlOutput) if (xmlOutput)

View file

@ -70,7 +70,8 @@ UnresolvedApp InstallableValue::toApp(EvalState & state)
std::vector<DerivedPath> context2; std::vector<DerivedPath> context2;
for (auto & c : context) { for (auto & c : context) {
context2.emplace_back(std::visit( context2.emplace_back(
std::visit(
overloaded{ overloaded{
[&](const NixStringContextElem::DrvDeep & d) -> DerivedPath { [&](const NixStringContextElem::DrvDeep & d) -> DerivedPath {
/* We want all outputs of the drv */ /* We want all outputs of the drv */

View file

@ -402,7 +402,8 @@ void mainWrapped(int argc, char ** argv)
self-aware. That is, it has to know where it is installed. We self-aware. That is, it has to know where it is installed. We
don't think it's sentient. don't think it's sentient.
*/ */
settings.buildHook.setDefault(Strings{ settings.buildHook.setDefault(
Strings{
getNixBin({}).string(), getNixBin({}).string(),
"__build-remote", "__build-remote",
}); });

View file

@ -15,7 +15,8 @@ void runNix(Path program, const Strings & args, const std::optional<std::string>
auto subprocessEnv = getEnv(); auto subprocessEnv = getEnv();
subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue(); subprocessEnv["NIX_CONFIG"] = globalConfig.toKeyValue();
// isInteractive avoid grabling interactive commands // isInteractive avoid grabling interactive commands
runProgram2(RunOptions{ runProgram2(
RunOptions{
.program = getNixBin(program).string(), .program = getNixBin(program).string(),
.args = args, .args = args,
.environment = subprocessEnv, .environment = subprocessEnv,

View file

@ -34,7 +34,8 @@ struct CmdSearch : InstallableValueCommand, MixJSON
CmdSearch() CmdSearch()
{ {
expectArgs("regex", &res); expectArgs("regex", &res);
addFlag(Flag{ addFlag(
Flag{
.longName = "exclude", .longName = "exclude",
.shortName = 'e', .shortName = 'e',
.description = "Hide packages whose attribute path, name or description contain *regex*.", .description = "Hide packages whose attribute path, name or description contain *regex*.",

View file

@ -45,7 +45,8 @@ perl.pkgs.toPerlModule (
buildInputs = [ buildInputs = [
nix-store nix-store
] ++ finalAttrs.passthru.externalBuildInputs; ]
++ finalAttrs.passthru.externalBuildInputs;
# Hack for sake of the dev shell # Hack for sake of the dev shell
passthru.externalBuildInputs = [ passthru.externalBuildInputs = [

View file

@ -2,8 +2,7 @@ with import ./lib.nix;
let let
attrs = attrs = {
{
y = "y"; y = "y";
x = "x"; x = "x";
foo = "foo"; foo = "foo";

View file

@ -1,6 +1,5 @@
let { let {
as = as = {
{
x = 123; x = 123;
y = 456; y = 456;
} }

View file

@ -1,6 +1,5 @@
let { let {
as = as = {
{
x = 123; x = 123;
y = 456; y = 456;
} }

View file

@ -6,7 +6,8 @@ let
scopedImport = attrs: fn: scopedImport (overrides // attrs) fn; scopedImport = attrs: fn: scopedImport (overrides // attrs) fn;
builtins = builtins // overrides; builtins = builtins // overrides;
} // import ./lib.nix; }
// import ./lib.nix;
in in
scopedImport overrides ./imported.nix scopedImport overrides ./imported.nix

View file

@ -6,8 +6,7 @@ mkDerivation {
name = "nested-sandboxing"; name = "nested-sandboxing";
busybox = builtins.getEnv "busybox"; busybox = builtins.getEnv "busybox";
EXTRA_SANDBOX = builtins.getEnv "EXTRA_SANDBOX"; EXTRA_SANDBOX = builtins.getEnv "EXTRA_SANDBOX";
buildCommand = buildCommand = ''
''
set -x set -x
set -eu -o pipefail set -eu -o pipefail
'' ''

View file

@ -46,8 +46,7 @@ mkMesonDerivation (
]; ];
# Hack for sake of the dev shell # Hack for sake of the dev shell
passthru.externalNativeBuildInputs = passthru.externalNativeBuildInputs = [
[
meson meson
ninja ninja
pkg-config pkg-config

View file

@ -77,7 +77,15 @@ let
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
imports = [ checkOverrideNixVersion ]; imports = [ checkOverrideNixVersion ];
nix.package = lib.mkForce pkgs.nixVersions.nix_2_3; nix.package = lib.mkForce (
pkgs.nixVersions.nix_2_3.overrideAttrs (o: {
meta = o.meta // {
# This version shouldn't be used by end-users, but we run tests against
# it to ensure we don't break protocol compatibility.
knownVulnerabilities = [ ];
};
})
);
}; };
otherNixes.nix_2_13.setNixPackage = otherNixes.nix_2_13.setNixPackage =
@ -88,6 +96,8 @@ let
nixpkgs-23-11.legacyPackages.${pkgs.stdenv.hostPlatform.system}.nixVersions.nix_2_13.overrideAttrs nixpkgs-23-11.legacyPackages.${pkgs.stdenv.hostPlatform.system}.nixVersions.nix_2_13.overrideAttrs
(o: { (o: {
meta = o.meta // { meta = o.meta // {
# This version shouldn't be used by end-users, but we run tests against
# it to ensure we don't break protocol compatibility.
knownVulnerabilities = [ ]; knownVulnerabilities = [ ];
}; };
}) })
@ -98,7 +108,9 @@ let
{ lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
imports = [ checkOverrideNixVersion ]; imports = [ checkOverrideNixVersion ];
nix.package = lib.mkForce pkgs.nixVersions.nix_2_18; nix.package =
lib.mkForce
nixpkgs-23-11.legacyPackages.${pkgs.stdenv.hostPlatform.system}.nixVersions.nix_2_18;
}; };
in in

View file

@ -45,14 +45,14 @@
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders. # Install the SSH key on the builders.
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
remote.succeed("mkdir -p -m 700 /root/.ssh") remote.succeed("mkdir -p -m 700 /root/.ssh")
remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys") remote.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
remote.wait_for_unit("sshd") remote.wait_for_unit("sshd")
remote.wait_for_unit("multi-user.target") remote.wait_for_unit("multi-user.target")
remote.wait_for_unit("network-online.target") remote.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
client.succeed(f"ssh -o StrictHostKeyChecking=no {remote.name} 'echo hello world'") client.succeed(f"ssh -o StrictHostKeyChecking=no {remote.name} 'echo hello world'")
remote.succeed(""" remote.succeed("""

View file

@ -187,9 +187,9 @@ in
github.succeed("cat /var/log/httpd/*.log >&2") github.succeed("cat /var/log/httpd/*.log >&2")
github.wait_for_unit("httpd.service") github.wait_for_unit("httpd.service")
github.wait_for_unit("network-online.target") github.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
client.succeed("curl -v https://github.com/ >&2") client.succeed("curl -v https://github.com/ >&2")
out = client.succeed("nix registry list") out = client.succeed("nix registry list")
print(out) print(out)

View file

@ -70,9 +70,9 @@ in
server.copy_from_host("key.pub", "/root/.ssh/authorized_keys") server.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
server.wait_for_unit("sshd") server.wait_for_unit("sshd")
server.wait_for_unit("multi-user.target") server.wait_for_unit("multi-user.target")
server.wait_for_unit("network-online.target") server.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
client.succeed(f"ssh -o StrictHostKeyChecking=no {server.name} 'echo hello world'") client.succeed(f"ssh -o StrictHostKeyChecking=no {server.name} 'echo hello world'")
# Copy the closure of package A from the client to the server. # Copy the closure of package A from the client to the server.

View file

@ -79,9 +79,9 @@ in
server.wait_for_unit("sshd") server.wait_for_unit("sshd")
server.wait_for_unit("multi-user.target") server.wait_for_unit("multi-user.target")
server.wait_for_unit("network-online.target") server.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("getty@tty1.service") client.wait_for_unit("getty@tty1.service")
# Either the prompt: ]# # Either the prompt: ]#
# or an OCR misreading of it: 1# # or an OCR misreading of it: 1#

View file

@ -61,7 +61,7 @@ in
{ nodes }: { nodes }:
'' ''
cache.wait_for_unit("harmonia.service") cache.wait_for_unit("harmonia.service")
cache.wait_for_unit("network-online.target") cache.wait_for_unit("network-addresses-eth1.service")
machine.succeed("mkdir -p /etc/containers") machine.succeed("mkdir -p /etc/containers")
machine.succeed("""echo '{"default":[{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json""") machine.succeed("""echo '{"default":[{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json""")

View file

@ -145,7 +145,7 @@ in
testScript = testScript =
{ nodes, ... }: { nodes, ... }:
'' ''
http_dns.wait_for_unit("network-online.target") http_dns.wait_for_unit("network-addresses-eth1.service")
http_dns.wait_for_unit("nginx") http_dns.wait_for_unit("nginx")
http_dns.wait_for_open_port(80) http_dns.wait_for_open_port(80)
http_dns.wait_for_unit("unbound") http_dns.wait_for_unit("unbound")
@ -153,7 +153,7 @@ in
client.start() client.start()
client.wait_for_unit('multi-user.target') client.wait_for_unit('multi-user.target')
client.wait_for_unit('network-online.target') client.wait_for_unit('network-addresses-eth1.service')
with subtest("can fetch data from a remote server outside sandbox"): with subtest("can fetch data from a remote server outside sandbox"):
client.succeed("nix --version >&2") client.succeed("nix --version >&2")

View file

@ -102,12 +102,12 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builder. # Install the SSH key on the builder.
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
builder.succeed("mkdir -p -m 700 /root/.ssh") builder.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys") builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd") builder.wait_for_unit("sshd")
builder.wait_for_unit("multi-user.target") builder.wait_for_unit("multi-user.target")
builder.wait_for_unit("network-online.target") builder.wait_for_unit("network-addresses-eth1.service")
client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'") client.succeed(f"ssh -o StrictHostKeyChecking=no {builder.name} 'echo hello world'")

View file

@ -123,12 +123,12 @@ in
client.succeed("chmod 600 /root/.ssh/id_ed25519") client.succeed("chmod 600 /root/.ssh/id_ed25519")
# Install the SSH key on the builders. # Install the SSH key on the builders.
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
for builder in [builder1, builder2]: for builder in [builder1, builder2]:
builder.succeed("mkdir -p -m 700 /root/.ssh") builder.succeed("mkdir -p -m 700 /root/.ssh")
builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys") builder.copy_from_host("key.pub", "/root/.ssh/authorized_keys")
builder.wait_for_unit("sshd") builder.wait_for_unit("sshd")
builder.wait_for_unit("network-online.target") builder.wait_for_unit("network-addresses-eth1.service")
# Make sure the builder can handle our login correctly # Make sure the builder can handle our login correctly
builder.wait_for_unit("multi-user.target") builder.wait_for_unit("multi-user.target")
# Make sure there's no funny business on the client either # Make sure there's no funny business on the client either

View file

@ -67,14 +67,14 @@ in
# Create a binary cache. # Create a binary cache.
server.wait_for_unit("minio") server.wait_for_unit("minio")
server.wait_for_unit("network-online.target") server.wait_for_unit("network-addresses-eth1.service")
server.succeed("mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4") server.succeed("mc config host add minio http://localhost:9000 ${accessKey} ${secretKey} --api s3v4")
server.succeed("mc mb minio/my-cache") server.succeed("mc mb minio/my-cache")
server.succeed("${env} nix copy --to '${storeUrl}' ${pkgA}") server.succeed("${env} nix copy --to '${storeUrl}' ${pkgA}")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
# Test fetchurl on s3:// URLs while we're at it. # Test fetchurl on s3:// URLs while we're at it.
client.succeed("${env} nix eval --impure --expr 'builtins.fetchurl { name = \"foo\"; url = \"s3://my-cache/nix-cache-info?endpoint=http://server:9000&region=eu-west-1\"; }'") client.succeed("${env} nix eval --impure --expr 'builtins.fetchurl { name = \"foo\"; url = \"s3://my-cache/nix-cache-info?endpoint=http://server:9000&region=eu-west-1\"; }'")

View file

@ -139,8 +139,8 @@ in
start_all() start_all()
sourcehut.wait_for_unit("httpd.service") sourcehut.wait_for_unit("httpd.service")
sourcehut.wait_for_unit("network-online.target") sourcehut.wait_for_unit("network-addresses-eth1.service")
client.wait_for_unit("network-online.target") client.wait_for_unit("network-addresses-eth1.service")
client.succeed("curl -v https://git.sr.ht/ >&2") client.succeed("curl -v https://git.sr.ht/ >&2")
client.succeed("nix registry list | grep nixpkgs") client.succeed("nix registry list | grep nixpkgs")