aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installable-flake.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-15 16:50:11 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-05-15 16:50:11 -0400
commit746c6aae3f4a2f80c730575bd6eca370efe58f2e (patch)
treeb03fa431442b3d9376068d431246ea6a62120810 /src/libcmd/installable-flake.cc
parent2524a2118647a4125dcae08fe0eb20de5f79a291 (diff)
parentf8a6a9e47314acebea2d72c0ec195360eb58bbec (diff)
Merge remote-tracking branch 'upstream/master' into best-effort-supplementary-groups
Diffstat (limited to 'src/libcmd/installable-flake.cc')
-rw-r--r--src/libcmd/installable-flake.cc32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/libcmd/installable-flake.cc b/src/libcmd/installable-flake.cc
index f0d322e6d..eb944240b 100644
--- a/src/libcmd/installable-flake.cc
+++ b/src/libcmd/installable-flake.cc
@@ -95,31 +95,13 @@ DerivedPathsWithInfo InstallableFlake::toDerivedPaths()
// FIXME: use eval cache?
auto v = attr->forceValue();
- if (v.type() == nPath) {
- auto storePath = v.path().fetchToStore(state->store);
- return {{
- .path = DerivedPath::Opaque {
- .path = std::move(storePath),
- },
- .info = make_ref<ExtraPathInfo>(),
- }};
- }
-
- else if (v.type() == nString) {
- NixStringContext context;
- auto s = state->forceString(v, context, noPos, fmt("while evaluating the flake output attribute '%s'", attrPath));
- auto storePath = state->store->maybeParseStorePath(s);
- if (storePath && context.count(NixStringContextElem::Opaque { .path = *storePath })) {
- return {{
- .path = DerivedPath::Opaque {
- .path = std::move(*storePath),
- },
- .info = make_ref<ExtraPathInfo>(),
- }};
- } else
- throw Error("flake output attribute '%s' evaluates to the string '%s' which is not a store path", attrPath, s);
+ if (std::optional derivedPathWithInfo = trySinglePathToDerivedPaths(
+ v,
+ noPos,
+ fmt("while evaluating the flake output attribute '%s'", attrPath)))
+ {
+ return { *derivedPathWithInfo };
}
-
else
throw Error("flake output attribute '%s' is not a derivation or path", attrPath);
}
@@ -234,7 +216,7 @@ FlakeRef InstallableFlake::nixpkgsFlakeRef() const
}
}
- return InstallableValue::nixpkgsFlakeRef();
+ return defaultNixpkgsFlakeRef();
}
}