aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/fetchers/registry.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/fetchers/registry.hh')
-rw-r--r--src/libstore/fetchers/registry.hh55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/libstore/fetchers/registry.hh b/src/libstore/fetchers/registry.hh
new file mode 100644
index 000000000..e29f78486
--- /dev/null
+++ b/src/libstore/fetchers/registry.hh
@@ -0,0 +1,55 @@
+#pragma once
+
+#include "types.hh"
+
+namespace nix { class Store; }
+
+namespace nix::fetchers {
+
+struct Input;
+
+struct Registry
+{
+ enum RegistryType {
+ Flag = 0,
+ User = 1,
+ Global = 2,
+ };
+
+ RegistryType type;
+
+ std::vector<std::pair<std::shared_ptr<const Input>, std::shared_ptr<const Input>>> entries;
+
+ Registry(RegistryType type)
+ : type(type)
+ { }
+
+ static std::shared_ptr<Registry> read(
+ const Path & path, RegistryType type);
+
+ void write(const Path & path);
+
+ void add(
+ const std::shared_ptr<const Input> & from,
+ const std::shared_ptr<const Input> & to);
+
+ void remove(const std::shared_ptr<const Input> & input);
+};
+
+typedef std::vector<std::shared_ptr<Registry>> Registries;
+
+std::shared_ptr<Registry> getUserRegistry();
+
+Path getUserRegistryPath();
+
+Registries getRegistries(ref<Store> store);
+
+void overrideRegistry(
+ const std::shared_ptr<const Input> & from,
+ const std::shared_ptr<const Input> & to);
+
+std::shared_ptr<const Input> lookupInRegistries(
+ ref<Store> store,
+ std::shared_ptr<const Input> input);
+
+}