2022-01-30 03:12:22 +03:00
|
|
|
{ lib
|
|
|
|
, registryFromDownloadUrl
|
|
|
|
}:
|
|
|
|
|
2022-01-31 02:10:28 +03:00
|
|
|
{ indexUrl
|
2022-01-30 03:12:22 +03:00
|
|
|
, rev
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
index = builtins.fetchGit {
|
2022-01-31 02:10:28 +03:00
|
|
|
inherit rev;
|
|
|
|
url = indexUrl;
|
2022-01-30 03:12:22 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
configPath = "${index}/config.json";
|
|
|
|
configContents =
|
|
|
|
if builtins.pathExists configPath then
|
|
|
|
builtins.readFile configPath
|
|
|
|
else
|
|
|
|
throw "registry index is missing a config.json file";
|
|
|
|
|
|
|
|
config = builtins.fromJSON configContents;
|
|
|
|
dl = config.dl or (throw ''
|
|
|
|
registry config does not have a "dl" endpoint:
|
|
|
|
${configContents}
|
|
|
|
'');
|
|
|
|
in
|
|
|
|
registryFromDownloadUrl {
|
2022-01-31 02:10:28 +03:00
|
|
|
inherit dl indexUrl;
|
2022-01-30 03:12:22 +03:00
|
|
|
}
|