From 1521a819b75810e9c0f0450745d66b4620fff3da Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Mon, 30 Jun 2025 10:18:10 -0700 Subject: [PATCH] external-derivation-builder: `args` must always be specified I don't want to figure out how to make nlohmann treat std::optional<> the same way Rust's serde_json treats Option<> (i.e. skip it if it's not there). --- src/libstore/include/nix/store/globals.hh | 2 +- src/libstore/unix/build/external-derivation-builder.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libstore/include/nix/store/globals.hh b/src/libstore/include/nix/store/globals.hh index 2976ee57a..f7c714777 100644 --- a/src/libstore/include/nix/store/globals.hh +++ b/src/libstore/include/nix/store/globals.hh @@ -1241,7 +1241,7 @@ public: { std::vector systems; Path program; - std::optional> args; + std::vector args; }; using ExternalBuilders = std::vector; diff --git a/src/libstore/unix/build/external-derivation-builder.cc b/src/libstore/unix/build/external-derivation-builder.cc index 0757ed51f..1906ddd70 100644 --- a/src/libstore/unix/build/external-derivation-builder.cc +++ b/src/libstore/unix/build/external-derivation-builder.cc @@ -94,8 +94,8 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl Strings args = {externalBuilder.program}; - if (externalBuilder.args) { - args.insert(args.end(), externalBuilder.args->begin(), externalBuilder.args->end()); + if (!externalBuilder.args.empty()) { + args.insert(args.end(), externalBuilder.args.begin(), externalBuilder.args.end()); } args.insert(args.end(), jsonFile);