forked from lix-project/lix
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
|
@ -530,7 +530,7 @@ LockedFlake lockFlake(
|
||||||
auto [sourceInfo, lockedRef] = fetchOrSubstituteTree(
|
auto [sourceInfo, lockedRef] = fetchOrSubstituteTree(
|
||||||
state, input.ref, {}, lockFlags.useRegistries, flakeCache);
|
state, input.ref, {}, lockFlags.useRegistries, flakeCache);
|
||||||
newLocks.inputs.insert_or_assign(id,
|
newLocks.inputs.insert_or_assign(id,
|
||||||
LockedInput(lockedRef, input.ref, sourceInfo.info));
|
LockedInput(lockedRef, input.ref, sourceInfo.info, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ LockedInput::LockedInput(const nlohmann::json & json)
|
||||||
, lockedRef(getFlakeRef(json, "url", "uri", "locked"))
|
, lockedRef(getFlakeRef(json, "url", "uri", "locked"))
|
||||||
, originalRef(getFlakeRef(json, "originalUrl", "originalUri", "original"))
|
, originalRef(getFlakeRef(json, "originalUrl", "originalUri", "original"))
|
||||||
, info(parseTreeInfo(json))
|
, info(parseTreeInfo(json))
|
||||||
|
, isFlake(json.find("flake") != json.end() ? (bool) json["flake"] : true)
|
||||||
{
|
{
|
||||||
if (!lockedRef.input->isImmutable())
|
if (!lockedRef.input->isImmutable())
|
||||||
throw Error("lockfile contains mutable flakeref '%s'", lockedRef);
|
throw Error("lockfile contains mutable flakeref '%s'", lockedRef);
|
||||||
|
@ -95,6 +96,7 @@ nlohmann::json LockedInput::toJson() const
|
||||||
json["original"] = fetchers::attrsToJson(originalRef.toAttrs());
|
json["original"] = fetchers::attrsToJson(originalRef.toAttrs());
|
||||||
json["locked"] = fetchers::attrsToJson(lockedRef.toAttrs());
|
json["locked"] = fetchers::attrsToJson(lockedRef.toAttrs());
|
||||||
json["info"] = treeInfoToJson(info);
|
json["info"] = treeInfoToJson(info);
|
||||||
|
if (!isFlake) json["flake"] = false;
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,14 @@ struct LockedInput : LockedInputs
|
||||||
{
|
{
|
||||||
FlakeRef lockedRef, originalRef;
|
FlakeRef lockedRef, originalRef;
|
||||||
TreeInfo info;
|
TreeInfo info;
|
||||||
|
bool isFlake = true;
|
||||||
|
|
||||||
LockedInput(const FlakeRef & lockedRef, const FlakeRef & originalRef, const TreeInfo & info)
|
LockedInput(
|
||||||
: lockedRef(lockedRef), originalRef(originalRef), info(info)
|
const FlakeRef & lockedRef,
|
||||||
|
const FlakeRef & originalRef,
|
||||||
|
const TreeInfo & info,
|
||||||
|
bool isFlake = true)
|
||||||
|
: lockedRef(lockedRef), originalRef(originalRef), info(info), isFlake(isFlake)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
LockedInput(const nlohmann::json & json);
|
LockedInput(const nlohmann::json & json);
|
||||||
|
@ -52,7 +57,8 @@ struct LockedInput : LockedInputs
|
||||||
lockedRef == other.lockedRef
|
lockedRef == other.lockedRef
|
||||||
&& originalRef == other.originalRef
|
&& originalRef == other.originalRef
|
||||||
&& info == other.info
|
&& info == other.info
|
||||||
&& inputs == other.inputs;
|
&& inputs == other.inputs
|
||||||
|
&& isFlake == other.isFlake;
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json toJson() const;
|
nlohmann::json toJson() const;
|
||||||
|
|
Loading…
Reference in a new issue