Nix 2.26.3
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 "types.hh"
5#include "fetchers.hh"
6
7namespace nix { class Store; }
8
9namespace nix::fetchers {
10
11struct Registry
12{
13 const Settings & settings;
14
15 enum RegistryType {
16 Flag = 0,
17 User = 1,
18 System = 2,
19 Global = 3,
20 Custom = 4,
21 };
22
23 RegistryType type;
24
25 struct Entry
26 {
27 Input from, to;
28 Attrs extraAttrs;
29 bool exact = false;
30 };
31
32 std::vector<Entry> entries;
33
34 Registry(const Settings & settings, RegistryType type)
35 : settings{settings}
36 , type{type}
37 { }
38
39 static std::shared_ptr<Registry> read(
40 const Settings & settings,
41 const Path & path, RegistryType type);
42
43 void write(const Path & path);
44
45 void add(
46 const Input & from,
47 const Input & to,
48 const Attrs & extraAttrs);
49
50 void remove(const Input & input);
51};
52
53typedef std::vector<std::shared_ptr<Registry>> Registries;
54
55std::shared_ptr<Registry> getUserRegistry(const Settings & settings);
56
57std::shared_ptr<Registry> getCustomRegistry(const Settings & settings, const Path & p);
58
59Path getUserRegistryPath();
60
61Registries getRegistries(const Settings & settings, ref<Store> store);
62
63void overrideRegistry(
64 const Input & from,
65 const Input & to,
66 const Attrs & extraAttrs);
67
68using RegistryFilter = std::function<bool(Registry::RegistryType)>;
69
74std::pair<Input, Attrs> lookupInRegistries(
76 const Input & input,
77 const RegistryFilter & filter = {});
78
79}
std::map< std::string, Attr > Attrs
Definition attrs.hh:22
Definition globals.hh:42
Definition store-api.hh:169
Definition ref.hh:15
ChunkedVector< std::string, 8192 > store
Definition lexer.l:1011
std::shared_ptr< T > p
Definition lexer.l:1269
ValueType type
Definition lexer.l:7098
std::string std::string_view from
Definition lexer.l:2591
std::string std::string_view std::string_view to
Definition lexer.l:2592
Definition fetchers.hh:32
Definition registry.hh:26
Definition fetch-settings.hh:15
std::string Path
Definition types.hh:22