aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-11 23:50:16 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-11 23:50:16 +0100
commit442e665d6d3fcbdee7dece2f62a597142f8784b1 (patch)
tree1a932eef1777ff8536669ac0d9cef8f859df0695 /src/libstore
parentd2032edb2f86e955a8a7724a27c0c3225f386500 (diff)
nix path-info --json: Print hash in SRI format
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/store-api.cc6
-rw-r--r--src/libstore/store-api.hh1
2 files changed, 5 insertions, 2 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index e37829b17..5ca77b563 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -442,7 +442,9 @@ string Store::makeValidityRegistration(const StorePathSet & paths,
void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
- bool includeImpureInfo, bool showClosureSize, AllowInvalidFlag allowInvalid)
+ bool includeImpureInfo, bool showClosureSize,
+ Base hashBase,
+ AllowInvalidFlag allowInvalid)
{
auto jsonList = jsonOut.list();
@@ -454,7 +456,7 @@ void Store::pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & store
auto info = queryPathInfo(storePath);
jsonPath
- .attr("narHash", info->narHash.to_string())
+ .attr("narHash", info->narHash.to_string(hashBase))
.attr("narSize", info->narSize);
{
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 0aaec20d1..85851e211 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -541,6 +541,7 @@ public:
each path is included. */
void pathInfoToJSON(JSONPlaceholder & jsonOut, const StorePathSet & storePaths,
bool includeImpureInfo, bool showClosureSize,
+ Base hashBase = Base32,
AllowInvalidFlag allowInvalid = DisallowInvalid);
/* Return the size of the closure of the specified path, that is,