mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
Add operator << for LockFile
Useful for debugging.
This commit is contained in:
parent
b971e406de
commit
9169046e64
1 changed files with 8 additions and 2 deletions
|
@ -121,7 +121,7 @@ nlohmann::json flakeEntryToJson(const LockFile::FlakeEntry & entry)
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeLockFile(const LockFile & lockFile, const Path & path)
|
std::ostream & operator <<(std::ostream & stream, const LockFile & lockFile)
|
||||||
{
|
{
|
||||||
nlohmann::json json;
|
nlohmann::json json;
|
||||||
json["version"] = 1;
|
json["version"] = 1;
|
||||||
|
@ -133,8 +133,14 @@ void writeLockFile(const LockFile & lockFile, const Path & path)
|
||||||
json["inputs"] = nlohmann::json::object();
|
json["inputs"] = nlohmann::json::object();
|
||||||
for (auto & x : lockFile.flakeEntries)
|
for (auto & x : lockFile.flakeEntries)
|
||||||
json["inputs"][x.first.to_string()] = flakeEntryToJson(x.second);
|
json["inputs"][x.first.to_string()] = flakeEntryToJson(x.second);
|
||||||
|
stream << json.dump(4); // '4' = indentation in json file
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeLockFile(const LockFile & lockFile, const Path & path)
|
||||||
|
{
|
||||||
createDirs(dirOf(path));
|
createDirs(dirOf(path));
|
||||||
writeFile(path, json.dump(4) + "\n"); // '4' = indentation in json file
|
writeFile(path, fmt("%s\n", lockFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Path getUserRegistryPath()
|
Path getUserRegistryPath()
|
||||||
|
|
Loading…
Reference in a new issue