diff options
author | pennae <82953136+pennae@users.noreply.github.com> | 2022-04-25 14:02:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 14:02:37 +0000 |
commit | d6d6bbd9ef1eed6443165866cd7bd27faa9586a1 (patch) | |
tree | 38e55dcce53445088725a86c14c903106879e0b6 /src/libstore/path.cc | |
parent | f2603e9c92947a0e0c01fc34e754270f46c63790 (diff) | |
parent | 7f814d6d9af9d78f922d59115a94078f807676a8 (diff) |
Merge branch 'master' into lto
Diffstat (limited to 'src/libstore/path.cc')
-rw-r--r-- | src/libstore/path.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/path.cc b/src/libstore/path.cc index e642abcd5..392db225e 100644 --- a/src/libstore/path.cc +++ b/src/libstore/path.cc @@ -1,5 +1,7 @@ #include "store-api.hh" +#include <sodium.h> + namespace nix { static void checkName(std::string_view path, std::string_view name) @@ -41,6 +43,13 @@ bool StorePath::isDerivation() const StorePath StorePath::dummy("ffffffffffffffffffffffffffffffff-x"); +StorePath StorePath::random(std::string_view name) +{ + Hash hash(htSHA1); + randombytes_buf(hash.hash, hash.hashSize); + return StorePath(hash, name); +} + StorePath Store::parseStorePath(std::string_view path) const { auto p = canonPath(std::string(path)); |