aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-15 13:48:56 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-15 13:48:56 +0200
commitf6d684b5e21966518d019c0225c3b0e8da2b6aff (patch)
treebfc14ae7792da58a1420821d72c56fa48e3d6f61
parent84c12dbd7c8f2b34c46908f4a0c43cbb86023f20 (diff)
getFlakeRegistries(): Return registries regardless of pureEval
This makes e.g. 'nix flake list' work.
-rw-r--r--src/libexpr/primops/flake.cc20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/libexpr/primops/flake.cc b/src/libexpr/primops/flake.cc
index 145d79446..e1eeffca6 100644
--- a/src/libexpr/primops/flake.cc
+++ b/src/libexpr/primops/flake.cc
@@ -126,7 +126,8 @@ void writeLockFile(LockFile lockFile, Path path)
std::shared_ptr<FlakeRegistry> getGlobalRegistry()
{
- return std::make_shared<FlakeRegistry>();
+ Path registryFile = settings.nixDataDir + "/nix/flake-registry.json";
+ return readRegistry(registryFile);
}
Path getUserRegistryPath()
@@ -139,12 +140,6 @@ std::shared_ptr<FlakeRegistry> getUserRegistry()
return readRegistry(getUserRegistryPath());
}
-std::shared_ptr<FlakeRegistry> getLocalRegistry()
-{
- Path registryFile = settings.nixDataDir + "/nix/flake-registry.json";
- return readRegistry(registryFile);
-}
-
std::shared_ptr<FlakeRegistry> getFlagRegistry()
{
// TODO (Nick): Implement this.
@@ -154,15 +149,8 @@ std::shared_ptr<FlakeRegistry> getFlagRegistry()
const std::vector<std::shared_ptr<FlakeRegistry>> EvalState::getFlakeRegistries()
{
std::vector<std::shared_ptr<FlakeRegistry>> registries;
- if (evalSettings.pureEval) {
- registries.push_back(std::make_shared<FlakeRegistry>()); // global
- registries.push_back(std::make_shared<FlakeRegistry>()); // user
- registries.push_back(std::make_shared<FlakeRegistry>()); // local
- } else {
- registries.push_back(getGlobalRegistry());
- registries.push_back(getUserRegistry());
- registries.push_back(getLocalRegistry());
- }
+ registries.push_back(getGlobalRegistry());
+ registries.push_back(getUserRegistry());
registries.push_back(getFlagRegistry());
return registries;
}