Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
registry.hh
Go to the documentation of this file.
1#pragma once
3
4#include "nix/util/types.hh"
7
8namespace nix {
9class Store;
10}
11
12namespace nix::fetchers {
13
14struct Registry
15{
16 enum RegistryType {
17 Flag = 0,
18 User = 1,
19 System = 2,
20 Global = 3,
21 Custom = 4,
22 };
23
24 RegistryType type;
25
26 struct Entry
27 {
28 Input from, to;
29 Attrs extraAttrs;
30 bool exact = false;
31 };
32
33 std::vector<Entry> entries;
34
35 Registry(RegistryType type)
36 : type{type}
37 {
38 }
39
40 static std::shared_ptr<Registry> read(const Settings & settings, const SourcePath & path, RegistryType type);
41
42 void write(const std::filesystem::path & path);
43
44 void add(const Input & from, const Input & to, const Attrs & extraAttrs);
45
46 void remove(const Input & input);
47};
48
49typedef std::vector<std::shared_ptr<Registry>> Registries;
50
51std::shared_ptr<Registry> getUserRegistry(const Settings & settings);
52
53std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const std::filesystem::path & p);
54
55std::filesystem::path getUserRegistryPath();
56
57Registries getRegistries(const Settings & settings, Store & store);
58
59void overrideRegistry(const Input & from, const Input & to, const Attrs & extraAttrs);
60
61enum class UseRegistries : int {
62 No,
63 All,
64 Limited, // global and flag registry only
65};
66
71std::pair<Input, Attrs>
72lookupInRegistries(const Settings & settings, Store & store, const Input & input, UseRegistries useRegistries);
73
74} // namespace nix::fetchers
std::map< std::string, Attr > Attrs
Definition attrs.hh:68
Definition globals.hh:106
Definition store-api.hh:397
size_t write(Descriptor fd, std::span< const std::byte > buffer, bool allowInterrupts)
Definition file-descriptor.cc:54
size_t read(Descriptor fd, std::span< std::byte > buffer)
Definition file-descriptor.cc:30
SourcePath.
Definition source-path.hh:22
Definition fetchers.hh:36
Definition registry.hh:27
Definition fetch-settings.hh:27