Add flake registry
This will eventually be moved to nixos.org.
This commit is contained in:
parent
dcae46ab14
commit
52419f8db3
3 changed files with 19 additions and 2 deletions
11
flake-registry.json
Normal file
11
flake-registry.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"flakes": {
|
||||||
|
"dwarffs": {
|
||||||
|
"uri": "github:edolstra/dwarffs/flake"
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"uri": "github:edolstra/nixpkgs/flake"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
local.mk
2
local.mk
|
@ -10,3 +10,5 @@ GLOBAL_CXXFLAGS += -I . -I src -I src/libutil -I src/libstore -I src/libmain -I
|
||||||
|
|
||||||
$(foreach i, config.h $(call rwildcard, src/lib*, *.hh), \
|
$(foreach i, config.h $(call rwildcard, src/lib*, *.hh), \
|
||||||
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
$(eval $(call install-file-in, $(i), $(includedir)/nix, 0644)))
|
||||||
|
|
||||||
|
$(eval $(call install-data-in,$(d)/flake-registry.json,$(datadir)/nix))
|
||||||
|
|
|
@ -17,15 +17,19 @@ const EvalState::FlakeRegistry & EvalState::getFlakeRegistry()
|
||||||
|
|
||||||
if (!evalSettings.pureEval) {
|
if (!evalSettings.pureEval) {
|
||||||
|
|
||||||
|
#if 0
|
||||||
auto registryUri = "file:///home/eelco/Dev/gists/nix-flakes/registry.json";
|
auto registryUri = "file:///home/eelco/Dev/gists/nix-flakes/registry.json";
|
||||||
|
|
||||||
auto registryFile = getDownloader()->download(DownloadRequest(registryUri));
|
auto registryFile = getDownloader()->download(DownloadRequest(registryUri));
|
||||||
|
#endif
|
||||||
|
|
||||||
auto json = nlohmann::json::parse(*registryFile.data);
|
auto registryFile = readFile(settings.nixDataDir + "/nix/flake-registry.json");
|
||||||
|
|
||||||
|
auto json = nlohmann::json::parse(registryFile);
|
||||||
|
|
||||||
auto version = json.value("version", 0);
|
auto version = json.value("version", 0);
|
||||||
if (version != 1)
|
if (version != 1)
|
||||||
throw Error("flake registry '%s' has unsupported version %d", registryUri, version);
|
throw Error("flake registry '%s' has unsupported version %d", registryFile, version);
|
||||||
|
|
||||||
auto flakes = json["flakes"];
|
auto flakes = json["flakes"];
|
||||||
for (auto i = flakes.begin(); i != flakes.end(); ++i) {
|
for (auto i = flakes.begin(); i != flakes.end(); ++i) {
|
||||||
|
|
Loading…
Reference in a new issue