This commit is contained in:
Eelco Dolstra 2020-04-02 11:55:41 +02:00
parent 021634e3e3
commit 00e1400eb7

View file

@ -0,0 +1,26 @@
#include "tree-info.hh"
#include "store-api.hh"
#include <nlohmann/json.hpp>
namespace nix::fetchers {
StorePath TreeInfo::computeStorePath(Store & store) const
{
assert(narHash);
return store.makeFixedOutputPath(true, narHash, "source");
}
nlohmann::json TreeInfo::toJson() const
{
nlohmann::json json;
assert(narHash);
json["narHash"] = narHash.to_string(SRI);
if (revCount)
json["revCount"] = *revCount;
if (lastModified)
json["lastModified"] = *lastModified;
return json;
}
}