1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 19:57:59 +02:00

Pluggable fetchers

Flakes are now fetched using an extensible mechanism. Also lots of
other flake cleanups.
This commit is contained in:
Eelco Dolstra 2020-01-21 16:27:53 +01:00
parent 1bf9eb21b7
commit 9f4d8c6170
34 changed files with 1613 additions and 1298 deletions

View file

@ -7,8 +7,8 @@ namespace nix::flake {
LockedInput::LockedInput(const nlohmann::json & json)
: LockedInputs(json)
, ref(json.value("url", json.value("uri", "")))
, originalRef(json.value("originalUrl", json.value("originalUri", "")))
, ref(parseFlakeRef(json.value("url", json.value("uri", ""))))
, originalRef(parseFlakeRef(json.value("originalUrl", json.value("originalUri", ""))))
, narHash(Hash((std::string) json["narHash"]))
{
if (!ref.isImmutable())
@ -47,12 +47,12 @@ nlohmann::json LockedInputs::toJson() const
return json;
}
bool LockedInputs::isDirty() const
bool LockedInputs::isImmutable() const
{
for (auto & i : inputs)
if (i.second.ref.isDirty() || i.second.isDirty()) return true;
if (!i.second.ref.isImmutable() || !i.second.isImmutable()) return false;
return false;
return true;
}
nlohmann::json LockFile::toJson() const