aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-03-21 09:30:16 +0100
committerNick Van den Broeck <nick.van.den.broeck666@gmail.com>2019-04-30 11:26:45 +0200
commit24b35bf9e7219feba9399466c41801f0ace3ef74 (patch)
tree4696c5bb2dc7b3427575bf1fc21bbf1727566fb7 /src/libexpr/primops
parente6109ec76538f05723863dce5a84a3d4f5a85cb7 (diff)
Fixed issue #13
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/flake.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc
index f6744a1f7..5af0c49c7 100644
--- a/src/libexpr/primops/flake.cc
+++ b/src/libexpr/primops/flake.cc
@@ -140,10 +140,13 @@ std::shared_ptr<FlakeRegistry> getUserRegistry()
return readRegistry(getUserRegistryPath());
}
-std::shared_ptr<FlakeRegistry> getFlagRegistry()
+std::shared_ptr<FlakeRegistry> getFlagRegistry(RegistryOverrides registryOverrides)
{
- // TODO (Nick): Implement this.
- return std::make_shared<FlakeRegistry>();
+ auto flagRegistry = std::make_shared<FlakeRegistry>();
+ for (auto const & x : registryOverrides) {
+ flagRegistry->entries.insert_or_assign(FlakeRef(x.first), FlakeRef(x.second));
+ }
+ return flagRegistry;
}
// This always returns a vector with flakeRef, userReg, globalReg.
@@ -151,7 +154,7 @@ std::shared_ptr<FlakeRegistry> getFlagRegistry()
const Registries EvalState::getFlakeRegistries()
{
Registries registries;
- registries.push_back(getFlagRegistry());
+ registries.push_back(getFlagRegistry(registryOverrides));
registries.push_back(getUserRegistry());
registries.push_back(getGlobalRegistry());
return registries;
@@ -357,9 +360,8 @@ NonFlake getNonFlake(EvalState & state, const FlakeRef & flakeRef, FlakeAlias al
ResolvedFlake resolveFlake(EvalState & state, const FlakeRef & topRef,
RegistryAccess registryAccess, bool isTopFlake)
{
- Flake flake = getFlake(state, topRef,
- registryAccess == AllowRegistry || (registryAccess == AllowRegistryAtTop && isTopFlake));
-
+ bool allowRegistries = registryAccess == AllowRegistry || (registryAccess == AllowRegistryAtTop && isTopFlake);
+ Flake flake = getFlake(state, topRef, allowRegistries);
LockFile lockFile;
if (isTopFlake)
@@ -405,10 +407,8 @@ static LockFile makeLockFile(EvalState & evalState, FlakeRef & flakeRef)
void updateLockFile(EvalState & state, const Path & path)
{
- // FIXME: don't copy 'path' to the store (especially since we
- // dirty it immediately afterwards).
-
- FlakeRef flakeRef = FlakeRef(path); // FIXME: ugly
+ // FIXME: We are writing the lockfile to the store here! Very bad practice!
+ FlakeRef flakeRef = FlakeRef(path);
auto lockFile = makeLockFile(state, flakeRef);
writeLockFile(lockFile, path + "/flake.lock");