aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-21 19:04:58 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-21 19:04:58 +0200
commitd4fe9daed6f48ebdcea18a1952cbecd30a846e70 (patch)
tree073efc12b13ca8bc9950837db81f2d2baf0f9dec /src/nix
parentaa2846198f46c1260a91a6bf21a2f53997f1f274 (diff)
Simplify getFlake() / fetchFlake() logic
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/flake.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 91c6b4276..49f7c33c7 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -38,7 +38,8 @@ public:
Flake getFlake()
{
auto evalState = getEvalState();
- return flake::getFlake(*evalState, getFlakeRef(), useRegistries);
+ return flake::getFlake(*evalState,
+ maybeLookupFlake(*evalState, getFlakeRef(), useRegistries));
}
ResolvedFlake resolveFlake()
@@ -425,13 +426,13 @@ struct CmdFlakePin : virtual Args, EvalCommand
FlakeRegistry userRegistry = *readRegistry(userRegistryPath);
auto it = userRegistry.entries.find(FlakeRef(alias));
if (it != userRegistry.entries.end()) {
- it->second = getFlake(*evalState, it->second, true).sourceInfo.resolvedRef;
+ it->second = getFlake(*evalState, maybeLookupFlake(*evalState, it->second, true)).sourceInfo.resolvedRef;
writeRegistry(userRegistry, userRegistryPath);
} else {
std::shared_ptr<FlakeRegistry> globalReg = evalState->getGlobalFlakeRegistry();
it = globalReg->entries.find(FlakeRef(alias));
if (it != globalReg->entries.end()) {
- auto newRef = getFlake(*evalState, it->second, true).sourceInfo.resolvedRef;
+ auto newRef = getFlake(*evalState, maybeLookupFlake(*evalState, it->second, true)).sourceInfo.resolvedRef;
userRegistry.entries.insert_or_assign(alias, newRef);
writeRegistry(userRegistry, userRegistryPath);
} else