Add TreeInfo::computeStorePath()

This commit is contained in:
Eelco Dolstra 2020-02-02 12:29:53 +01:00
parent 7bcc9f2aaf
commit fad9faf354
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 16 additions and 3 deletions

View file

@ -111,8 +111,7 @@ nlohmann::json LockedInput::toJson() const
StorePath LockedInput::computeStorePath(Store & store) const StorePath LockedInput::computeStorePath(Store & store) const
{ {
assert(info.narHash); return info.computeStorePath(store);
return store.makeFixedOutputPath(true, info.narHash, "source");
} }
LockedInputs::LockedInputs(const nlohmann::json & json) LockedInputs::LockedInputs(const nlohmann::json & json)

View file

@ -11,6 +11,8 @@ struct StorePath;
namespace nix::flake { namespace nix::flake {
using namespace fetchers;
typedef std::vector<FlakeId> InputPath; typedef std::vector<FlakeId> InputPath;
struct LockedInput; struct LockedInput;

View file

@ -107,4 +107,10 @@ std::shared_ptr<const Input> Input::applyOverrides(
return shared_from_this(); return shared_from_this();
} }
StorePath TreeInfo::computeStorePath(Store & store) const
{
assert(narHash);
return store.makeFixedOutputPath(true, narHash, "source");
}
} }

View file

@ -1,6 +1,10 @@
#pragma once #pragma once
namespace nix { #include "path.hh"
namespace nix { class Store; }
namespace nix::fetchers {
struct TreeInfo struct TreeInfo
{ {
@ -15,6 +19,8 @@ struct TreeInfo
&& revCount == other.revCount && revCount == other.revCount
&& lastModified == other.lastModified; && lastModified == other.lastModified;
} }
StorePath computeStorePath(Store & store) const;
}; };
} }