aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcmd/installables.cc28
-rw-r--r--src/libcmd/installables.hh6
-rw-r--r--src/libexpr/flake/flakeref.cc6
-rw-r--r--src/libexpr/flake/flakeref.hh2
-rw-r--r--src/libstore/outputs-spec.cc26
-rw-r--r--src/libstore/outputs-spec.hh12
-rw-r--r--src/libstore/tests/outputs-spec.cc26
-rw-r--r--src/nix/bundle.cc4
-rw-r--r--src/nix/profile.cc10
9 files changed, 60 insertions, 60 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc
index ce40986d0..b80ae4df1 100644
--- a/src/libcmd/installables.cc
+++ b/src/libcmd/installables.cc
@@ -446,19 +446,19 @@ struct InstallableAttrPath : InstallableValue
SourceExprCommand & cmd;
RootValue v;
std::string attrPath;
- OutputsSpec outputsSpec;
+ ExtendedOutputsSpec extendedOutputsSpec;
InstallableAttrPath(
ref<EvalState> state,
SourceExprCommand & cmd,
Value * v,
const std::string & attrPath,
- OutputsSpec outputsSpec)
+ ExtendedOutputsSpec extendedOutputsSpec)
: InstallableValue(state)
, cmd(cmd)
, v(allocRootValue(v))
, attrPath(attrPath)
- , outputsSpec(std::move(outputsSpec))
+ , extendedOutputsSpec(std::move(extendedOutputsSpec))
{ }
std::string what() const override { return attrPath; }
@@ -490,10 +490,10 @@ struct InstallableAttrPath : InstallableValue
std::set<std::string> outputsToInstall;
- if (auto outputNames = std::get_if<OutputNames>(&outputsSpec))
+ if (auto outputNames = std::get_if<OutputNames>(&extendedOutputsSpec))
outputsToInstall = *outputNames;
else
- for (auto & output : drvInfo.queryOutputs(false, std::get_if<DefaultOutputs>(&outputsSpec)))
+ for (auto & output : drvInfo.queryOutputs(false, std::get_if<DefaultOutputs>(&extendedOutputsSpec)))
outputsToInstall.insert(output.first);
auto derivedPath = byDrvPath.emplace(*drvPath, DerivedPath::Built { .drvPath = *drvPath }).first;
@@ -581,7 +581,7 @@ InstallableFlake::InstallableFlake(
ref<EvalState> state,
FlakeRef && flakeRef,
std::string_view fragment,
- OutputsSpec outputsSpec,
+ ExtendedOutputsSpec extendedOutputsSpec,
Strings attrPaths,
Strings prefixes,
const flake::LockFlags & lockFlags)
@@ -589,7 +589,7 @@ InstallableFlake::InstallableFlake(
flakeRef(flakeRef),
attrPaths(fragment == "" ? attrPaths : Strings{(std::string) fragment}),
prefixes(fragment == "" ? Strings{} : prefixes),
- outputsSpec(std::move(outputsSpec)),
+ extendedOutputsSpec(std::move(extendedOutputsSpec)),
lockFlags(lockFlags)
{
if (cmd && cmd->getAutoArgs(*state)->size())
@@ -657,7 +657,7 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
priority = aPriority->getInt();
}
- if (outputsToInstall.empty() || std::get_if<AllOutputs>(&outputsSpec)) {
+ if (outputsToInstall.empty() || std::get_if<AllOutputs>(&extendedOutputsSpec)) {
outputsToInstall.clear();
if (auto aOutputs = attr->maybeGetAttr(state->sOutputs))
for (auto & s : aOutputs->getListOfStrings())
@@ -667,7 +667,7 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
if (outputsToInstall.empty())
outputsToInstall.insert("out");
- if (auto outputNames = std::get_if<OutputNames>(&outputsSpec))
+ if (auto outputNames = std::get_if<OutputNames>(&extendedOutputsSpec))
outputsToInstall = *outputNames;
return {{
@@ -680,7 +680,7 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
.originalRef = flakeRef,
.resolvedRef = getLockedFlake()->flake.lockedRef,
.attrPath = attrPath,
- .outputsSpec = outputsSpec,
+ .extendedOutputsSpec = extendedOutputsSpec,
}
}};
}
@@ -797,12 +797,12 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
}
for (auto & s : ss) {
- auto [prefix, outputsSpec] = OutputsSpec::parse(s);
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(s);
result.push_back(
std::make_shared<InstallableAttrPath>(
state, *this, vFile,
prefix == "." ? "" : prefix,
- outputsSpec));
+ extendedOutputsSpec));
}
} else {
@@ -837,13 +837,13 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
}
try {
- auto [flakeRef, fragment, outputsSpec] = parseFlakeRefWithFragmentAndOutputsSpec(s, absPath("."));
+ auto [flakeRef, fragment, extendedOutputsSpec] = parseFlakeRefWithFragmentAndExtendedOutputsSpec(s, absPath("."));
result.push_back(std::make_shared<InstallableFlake>(
this,
getEvalState(),
std::move(flakeRef),
fragment,
- outputsSpec,
+ extendedOutputsSpec,
getDefaultFlakeAttrPaths(),
getDefaultFlakeAttrPathPrefixes(),
lockFlags));
diff --git a/src/libcmd/installables.hh b/src/libcmd/installables.hh
index 9b92cc4be..3d12639b0 100644
--- a/src/libcmd/installables.hh
+++ b/src/libcmd/installables.hh
@@ -59,7 +59,7 @@ struct ExtraPathInfo
std::optional<FlakeRef> resolvedRef;
std::optional<std::string> attrPath;
// FIXME: merge with DerivedPath's 'outputs' field?
- std::optional<OutputsSpec> outputsSpec;
+ std::optional<ExtendedOutputsSpec> extendedOutputsSpec;
};
/* A derived path with any additional info that commands might
@@ -169,7 +169,7 @@ struct InstallableFlake : InstallableValue
FlakeRef flakeRef;
Strings attrPaths;
Strings prefixes;
- OutputsSpec outputsSpec;
+ ExtendedOutputsSpec extendedOutputsSpec;
const flake::LockFlags & lockFlags;
mutable std::shared_ptr<flake::LockedFlake> _lockedFlake;
@@ -178,7 +178,7 @@ struct InstallableFlake : InstallableValue
ref<EvalState> state,
FlakeRef && flakeRef,
std::string_view fragment,
- OutputsSpec outputsSpec,
+ ExtendedOutputsSpec extendedOutputsSpec,
Strings attrPaths,
Strings prefixes,
const flake::LockFlags & lockFlags);
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index cfa279fb4..bc61e2c9a 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -238,15 +238,15 @@ std::pair<fetchers::Tree, FlakeRef> FlakeRef::fetchTree(ref<Store> store) const
return {std::move(tree), FlakeRef(std::move(lockedInput), subdir)};
}
-std::tuple<FlakeRef, std::string, OutputsSpec> parseFlakeRefWithFragmentAndOutputsSpec(
+std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
const std::string & url,
const std::optional<Path> & baseDir,
bool allowMissing,
bool isFlake)
{
- auto [prefix, outputsSpec] = OutputsSpec::parse(url);
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse(url);
auto [flakeRef, fragment] = parseFlakeRefWithFragment(prefix, baseDir, allowMissing, isFlake);
- return {std::move(flakeRef), fragment, outputsSpec};
+ return {std::move(flakeRef), fragment, extendedOutputsSpec};
}
}
diff --git a/src/libexpr/flake/flakeref.hh b/src/libexpr/flake/flakeref.hh
index 4ec79fb73..c4142fc20 100644
--- a/src/libexpr/flake/flakeref.hh
+++ b/src/libexpr/flake/flakeref.hh
@@ -80,7 +80,7 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
std::optional<std::pair<FlakeRef, std::string>> maybeParseFlakeRefWithFragment(
const std::string & url, const std::optional<Path> & baseDir = {});
-std::tuple<FlakeRef, std::string, OutputsSpec> parseFlakeRefWithFragmentAndOutputsSpec(
+std::tuple<FlakeRef, std::string, ExtendedOutputsSpec> parseFlakeRefWithFragmentAndExtendedOutputsSpec(
const std::string & url,
const std::optional<Path> & baseDir = {},
bool allowMissing = false,
diff --git a/src/libstore/outputs-spec.cc b/src/libstore/outputs-spec.cc
index b5ea7e325..c446976bc 100644
--- a/src/libstore/outputs-spec.cc
+++ b/src/libstore/outputs-spec.cc
@@ -6,7 +6,7 @@
namespace nix {
-std::pair<std::string, OutputsSpec> OutputsSpec::parse(std::string s)
+std::pair<std::string, ExtendedOutputsSpec> ExtendedOutputsSpec::parse(std::string s)
{
static std::regex regex(R"((.*)\^((\*)|([a-z]+(,[a-z]+)*)))");
@@ -20,43 +20,43 @@ std::pair<std::string, OutputsSpec> OutputsSpec::parse(std::string s)
return {match[1], tokenizeString<OutputNames>(match[4].str(), ",")};
}
-std::string OutputsSpec::to_string() const
+std::string ExtendedOutputsSpec::to_string() const
{
return std::visit(overloaded {
- [&](const OutputsSpec::Default &) -> std::string {
+ [&](const ExtendedOutputsSpec::Default &) -> std::string {
return "";
},
- [&](const OutputsSpec::All &) -> std::string {
+ [&](const ExtendedOutputsSpec::All &) -> std::string {
return "*";
},
- [&](const OutputsSpec::Names & outputNames) -> std::string {
+ [&](const ExtendedOutputsSpec::Names & outputNames) -> std::string {
return "^" + concatStringsSep(",", outputNames);
},
}, raw());
}
-void to_json(nlohmann::json & json, const OutputsSpec & outputsSpec)
+void to_json(nlohmann::json & json, const ExtendedOutputsSpec & extendedOutputsSpec)
{
- if (std::get_if<DefaultOutputs>(&outputsSpec))
+ if (std::get_if<DefaultOutputs>(&extendedOutputsSpec))
json = nullptr;
- else if (std::get_if<AllOutputs>(&outputsSpec))
+ else if (std::get_if<AllOutputs>(&extendedOutputsSpec))
json = std::vector<std::string>({"*"});
- else if (auto outputNames = std::get_if<OutputNames>(&outputsSpec))
+ else if (auto outputNames = std::get_if<OutputNames>(&extendedOutputsSpec))
json = *outputNames;
}
-void from_json(const nlohmann::json & json, OutputsSpec & outputsSpec)
+void from_json(const nlohmann::json & json, ExtendedOutputsSpec & extendedOutputsSpec)
{
if (json.is_null())
- outputsSpec = DefaultOutputs();
+ extendedOutputsSpec = DefaultOutputs();
else {
auto names = json.get<OutputNames>();
if (names == OutputNames({"*"}))
- outputsSpec = AllOutputs();
+ extendedOutputsSpec = AllOutputs();
else
- outputsSpec = names;
+ extendedOutputsSpec = names;
}
}
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh
index 6f886ccb6..5ed711a62 100644
--- a/src/libstore/outputs-spec.hh
+++ b/src/libstore/outputs-spec.hh
@@ -17,10 +17,10 @@ struct DefaultOutputs {
bool operator < (const DefaultOutputs & _) const { return false; }
};
-typedef std::variant<DefaultOutputs, AllOutputs, OutputNames> _OutputsSpecRaw;
+typedef std::variant<DefaultOutputs, AllOutputs, OutputNames> _ExtendedOutputsSpecRaw;
-struct OutputsSpec : _OutputsSpecRaw {
- using Raw = _OutputsSpecRaw;
+struct ExtendedOutputsSpec : _ExtendedOutputsSpecRaw {
+ using Raw = _ExtendedOutputsSpecRaw;
using Raw::Raw;
using Names = OutputNames;
@@ -33,12 +33,12 @@ struct OutputsSpec : _OutputsSpecRaw {
/* Parse a string of the form 'prefix^output1,...outputN' or
'prefix^*', returning the prefix and the outputs spec. */
- static std::pair<std::string, OutputsSpec> parse(std::string s);
+ static std::pair<std::string, ExtendedOutputsSpec> parse(std::string s);
std::string to_string() const;
};
-void to_json(nlohmann::json &, const OutputsSpec &);
-void from_json(const nlohmann::json &, OutputsSpec &);
+void to_json(nlohmann::json &, const ExtendedOutputsSpec &);
+void from_json(const nlohmann::json &, ExtendedOutputsSpec &);
}
diff --git a/src/libstore/tests/outputs-spec.cc b/src/libstore/tests/outputs-spec.cc
index 552380837..a3dd42341 100644
--- a/src/libstore/tests/outputs-spec.cc
+++ b/src/libstore/tests/outputs-spec.cc
@@ -4,42 +4,42 @@
namespace nix {
-TEST(OutputsSpec_parse, basic)
+TEST(ExtendedOutputsSpec_parse, basic)
{
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo");
ASSERT_EQ(prefix, "foo");
- ASSERT_TRUE(std::get_if<DefaultOutputs>(&outputsSpec));
+ ASSERT_TRUE(std::get_if<DefaultOutputs>(&extendedOutputsSpec));
}
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo^*");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo^*");
ASSERT_EQ(prefix, "foo");
- ASSERT_TRUE(std::get_if<AllOutputs>(&outputsSpec));
+ ASSERT_TRUE(std::get_if<AllOutputs>(&extendedOutputsSpec));
}
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo^out");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo^out");
ASSERT_EQ(prefix, "foo");
- ASSERT_TRUE(std::get<OutputNames>(outputsSpec) == OutputNames({"out"}));
+ ASSERT_TRUE(std::get<OutputNames>(extendedOutputsSpec) == OutputNames({"out"}));
}
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo^out,bin");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo^out,bin");
ASSERT_EQ(prefix, "foo");
- ASSERT_TRUE(std::get<OutputNames>(outputsSpec) == OutputNames({"out", "bin"}));
+ ASSERT_TRUE(std::get<OutputNames>(extendedOutputsSpec) == OutputNames({"out", "bin"}));
}
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo^bar^out,bin");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo^bar^out,bin");
ASSERT_EQ(prefix, "foo^bar");
- ASSERT_TRUE(std::get<OutputNames>(outputsSpec) == OutputNames({"out", "bin"}));
+ ASSERT_TRUE(std::get<OutputNames>(extendedOutputsSpec) == OutputNames({"out", "bin"}));
}
{
- auto [prefix, outputsSpec] = OutputsSpec::parse("foo^&*()");
+ auto [prefix, extendedOutputsSpec] = ExtendedOutputsSpec::parse("foo^&*()");
ASSERT_EQ(prefix, "foo^&*()");
- ASSERT_TRUE(std::get_if<DefaultOutputs>(&outputsSpec));
+ ASSERT_TRUE(std::get_if<DefaultOutputs>(&extendedOutputsSpec));
}
}
diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc
index 74a7973b0..a09dadff4 100644
--- a/src/nix/bundle.cc
+++ b/src/nix/bundle.cc
@@ -75,10 +75,10 @@ struct CmdBundle : InstallableCommand
auto val = installable->toValue(*evalState).first;
- auto [bundlerFlakeRef, bundlerName, outputsSpec] = parseFlakeRefWithFragmentAndOutputsSpec(bundler, absPath("."));
+ auto [bundlerFlakeRef, bundlerName, extendedOutputsSpec] = parseFlakeRefWithFragmentAndExtendedOutputsSpec(bundler, absPath("."));
const flake::LockFlags lockFlags{ .writeLockFile = false };
InstallableFlake bundler{this,
- evalState, std::move(bundlerFlakeRef), bundlerName, outputsSpec,
+ evalState, std::move(bundlerFlakeRef), bundlerName, extendedOutputsSpec,
{"bundlers." + settings.thisSystem.get() + ".default",
"defaultBundler." + settings.thisSystem.get()
},
diff --git a/src/nix/profile.cc b/src/nix/profile.cc
index 346c4e117..32364e720 100644
--- a/src/nix/profile.cc
+++ b/src/nix/profile.cc
@@ -22,7 +22,7 @@ struct ProfileElementSource
// FIXME: record original attrpath.
FlakeRef resolvedRef;
std::string attrPath;
- OutputsSpec outputs;
+ ExtendedOutputsSpec outputs;
bool operator < (const ProfileElementSource & other) const
{
@@ -126,7 +126,7 @@ struct ProfileManifest
parseFlakeRef(e[sOriginalUrl]),
parseFlakeRef(e[sUrl]),
e["attrPath"],
- e["outputs"].get<OutputsSpec>()
+ e["outputs"].get<ExtendedOutputsSpec>()
};
}
elements.emplace_back(std::move(element));
@@ -308,12 +308,12 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile
auto & [res, info] = builtPaths[installable.get()];
- if (info.originalRef && info.resolvedRef && info.attrPath && info.outputsSpec) {
+ if (info.originalRef && info.resolvedRef && info.attrPath && info.extendedOutputsSpec) {
element.source = ProfileElementSource {
.originalRef = *info.originalRef,
.resolvedRef = *info.resolvedRef,
.attrPath = *info.attrPath,
- .outputs = *info.outputsSpec,
+ .outputs = *info.extendedOutputsSpec,
};
}
@@ -497,7 +497,7 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
.originalRef = installable->flakeRef,
.resolvedRef = *info.resolvedRef,
.attrPath = *info.attrPath,
- .outputs = installable->outputsSpec,
+ .outputs = installable->extendedOutputsSpec,
};
installables.push_back(installable);