mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
Add 'flake' attribute to lock files to denote non-flakes
This commit is contained in:
parent
73b6d87e17
commit
5a1514adb8
3 changed files with 12 additions and 4 deletions
|
@ -72,6 +72,7 @@ LockedInput::LockedInput(const nlohmann::json & json)
|
|||
, lockedRef(getFlakeRef(json, "url", "uri", "locked"))
|
||||
, originalRef(getFlakeRef(json, "originalUrl", "originalUri", "original"))
|
||||
, info(parseTreeInfo(json))
|
||||
, isFlake(json.find("flake") != json.end() ? (bool) json["flake"] : true)
|
||||
{
|
||||
if (!lockedRef.input->isImmutable())
|
||||
throw Error("lockfile contains mutable flakeref '%s'", lockedRef);
|
||||
|
@ -95,6 +96,7 @@ nlohmann::json LockedInput::toJson() const
|
|||
json["original"] = fetchers::attrsToJson(originalRef.toAttrs());
|
||||
json["locked"] = fetchers::attrsToJson(lockedRef.toAttrs());
|
||||
json["info"] = treeInfoToJson(info);
|
||||
if (!isFlake) json["flake"] = false;
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue