#pragma once #include "types.hh" #include "fetchers.hh" namespace nix { class Store; } namespace nix::fetchers { struct Registry { enum RegistryType { Flag = 0, User = 1, System = 2, Global = 3, }; RegistryType type; struct Entry { std::shared_ptr from; std::shared_ptr to; Attrs extraAttrs; }; std::vector entries; Registry(RegistryType type) : type(type) { } static std::shared_ptr read( const Path & path, RegistryType type); void write(const Path & path); void add( const std::shared_ptr & from, const std::shared_ptr & to, const Attrs & extraAttrs); void remove(const std::shared_ptr & input); }; typedef std::vector> Registries; std::shared_ptr getUserRegistry(); Path getUserRegistryPath(); Registries getRegistries(ref store); void overrideRegistry( const std::shared_ptr & from, const std::shared_ptr & to, const Attrs & extraAttrs); std::pair, Attrs> lookupInRegistries( ref store, std::shared_ptr input); }