mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
950b46821f
The attributes previously stored in TreeInfo (narHash, revCount, lastModified) are now stored in Input. This makes it less arbitrary what attributes are stored where. As a result, the lock file format has changed. An entry like "info": { "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github" }, is now stored as "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github", "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, The 'Input' class is now a dumb set of attributes. All the fetcher implementations subclass InputScheme, not Input. This simplifies the API. Also, fix substitution of flake inputs. This was broken since lazy flake fetching started using fetchTree internally.
64 lines
1.1 KiB
C++
64 lines
1.1 KiB
C++
#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
|
|
{
|
|
Input from, to;
|
|
Attrs extraAttrs;
|
|
bool exact = false;
|
|
};
|
|
|
|
std::vector<Entry> 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 Input & from,
|
|
const Input & to,
|
|
const Attrs & extraAttrs);
|
|
|
|
void remove(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 Input & from,
|
|
const Input & to,
|
|
const Attrs & extraAttrs);
|
|
|
|
std::pair<Input, Attrs> lookupInRegistries(
|
|
ref<Store> store,
|
|
const Input & input);
|
|
|
|
}
|