diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 12:29:53 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-02-02 12:29:53 +0100 |
commit | fad9faf3545f115e33e522eb11802e2825c8c425 (patch) | |
tree | 47b05ccb2b5730a71b5ce70b8e70b9689ef92044 | |
parent | 7bcc9f2aaf87a08a7570610f45e99754fd74d3f6 (diff) |
Add TreeInfo::computeStorePath()
-rw-r--r-- | src/libexpr/flake/lockfile.cc | 3 | ||||
-rw-r--r-- | src/libexpr/flake/lockfile.hh | 2 | ||||
-rw-r--r-- | src/libstore/fetchers/fetchers.cc | 6 | ||||
-rw-r--r-- | src/libstore/fetchers/tree-info.hh | 8 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc index 6a64f113e..3d796eadc 100644 --- a/src/libexpr/flake/lockfile.cc +++ b/src/libexpr/flake/lockfile.cc @@ -111,8 +111,7 @@ nlohmann::json LockedInput::toJson() const StorePath LockedInput::computeStorePath(Store & store) const { - assert(info.narHash); - return store.makeFixedOutputPath(true, info.narHash, "source"); + return info.computeStorePath(store); } LockedInputs::LockedInputs(const nlohmann::json & json) diff --git a/src/libexpr/flake/lockfile.hh b/src/libexpr/flake/lockfile.hh index 6333a6875..6203c40cb 100644 --- a/src/libexpr/flake/lockfile.hh +++ b/src/libexpr/flake/lockfile.hh @@ -11,6 +11,8 @@ struct StorePath; namespace nix::flake { +using namespace fetchers; + typedef std::vector<FlakeId> InputPath; struct LockedInput; diff --git a/src/libstore/fetchers/fetchers.cc b/src/libstore/fetchers/fetchers.cc index 89cc9e774..373786f38 100644 --- a/src/libstore/fetchers/fetchers.cc +++ b/src/libstore/fetchers/fetchers.cc @@ -107,4 +107,10 @@ std::shared_ptr<const Input> Input::applyOverrides( return shared_from_this(); } +StorePath TreeInfo::computeStorePath(Store & store) const +{ + assert(narHash); + return store.makeFixedOutputPath(true, narHash, "source"); +} + } diff --git a/src/libstore/fetchers/tree-info.hh b/src/libstore/fetchers/tree-info.hh index 28ead8588..02e92759b 100644 --- a/src/libstore/fetchers/tree-info.hh +++ b/src/libstore/fetchers/tree-info.hh @@ -1,6 +1,10 @@ #pragma once -namespace nix { +#include "path.hh" + +namespace nix { class Store; } + +namespace nix::fetchers { struct TreeInfo { @@ -15,6 +19,8 @@ struct TreeInfo && revCount == other.revCount && lastModified == other.lastModified; } + + StorePath computeStorePath(Store & store) const; }; } |