diff options
Diffstat (limited to 'src/libfetchers/fetch-to-store.cc')
-rw-r--r-- | src/libfetchers/fetch-to-store.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libfetchers/fetch-to-store.cc b/src/libfetchers/fetch-to-store.cc new file mode 100644 index 000000000..f830a4963 --- /dev/null +++ b/src/libfetchers/fetch-to-store.cc @@ -0,0 +1,26 @@ +#include "fetch-to-store.hh" +#include "fetchers.hh" +#include "cache.hh" + +namespace nix { + +StorePath fetchToStore( + Store & store, + const SourcePath & path, + std::string_view name, + FileIngestionMethod method, + PathFilter * filter, + RepairFlag repair) +{ + Activity act(*logger, lvlChatty, actUnknown, fmt("copying '%s' to the store", path)); + + auto filter2 = filter ? *filter : defaultPathFilter; + + return + settings.readOnlyMode + ? store.computeStorePathForPath(name, path.path.abs(), method, htSHA256, filter2).first + : store.addToStore(name, path.path.abs(), method, htSHA256, filter2, repair); +} + + +} |