1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 23:28:26 -04:00
nix/src/libexpr/primops/flake.hh
2019-03-23 13:42:48 +01:00

53 lines
1.1 KiB
C++

#include "types.hh"
#include "flakeref.hh"
#include <variant>
namespace nix {
struct Value;
class EvalState;
struct FlakeRegistry
{
struct Entry
{
FlakeRef ref;
Entry(const FlakeRef & flakeRef) : ref(flakeRef) {};
Entry operator=(const Entry & entry) { return Entry(entry.ref); }
};
std::map<FlakeId, Entry> entries;
};
Path getUserRegistryPath();
Value * makeFlakeRegistryValue(EvalState & state);
Value * makeFlakeValue(EvalState & state, std::string flakeUri, Value & v);
std::shared_ptr<FlakeRegistry> readRegistry(const Path &);
void writeRegistry(FlakeRegistry, Path);
struct Flake
{
FlakeId id;
FlakeRef ref;
std::string description;
Path path;
std::vector<FlakeRef> requires;
std::shared_ptr<FlakeRegistry> lockFile;
Value * vProvides; // FIXME: gc
// commit hash
// date
// content hash
Flake(FlakeRef & flakeRef) : ref(flakeRef) {};
};
Flake getFlake(EvalState &, const FlakeRef &);
FlakeRegistry updateLockFile(EvalState &, Flake &);
void updateLockFile(EvalState &, std::string);
}