Fix build for Nix 2.19 to 2.21
Dependencies
- [2]
3KEFKH5FImport existing code - [3]
7YS2X7JJFix compilation against older Nix versions (tested with 2.13.6)
Change contents
- edit in src/fetcher.cpp at line 7
#if NIX_VERSION >= 0x021900#include <processes.hh>#endif - edit in src/fetcher.cpp at line 12
#if NIX_VERSION >= 0x022000#include <posix-source-accessor.hh>#endif#if NIX_VERSION >= 0x022100#include <fs-input-accessor.hh>#endif - edit in src/fetcher.cpp at line 88
#if NIX_VERSION < 0x021900 - edit in src/fetcher.cpp at line 94
#endif - edit in src/fetcher.cpp at line 101
#if NIX_VERSION < 0x022100 - edit in src/fetcher.cpp at line 105
#endif - edit in src/fetcher.cpp at line 110
#if NIX_VERSION < 0x021900 - edit in src/fetcher.cpp at line 115
#endif - edit in src/fetcher.cpp at line 136
#if NIX_VERSION >= 0x022100std::pair<StorePath, Input> fetchToStore(ref<Store> store, const Input &_input) const#else - edit in src/fetcher.cpp at line 140
#endif - edit in src/fetcher.cpp at line 153
#if NIX_VERSION >= 0x021900std::optional<Path> getSourcePath(const Input &input) const override#else - edit in src/fetcher.cpp at line 157
#endif - edit in src/fetcher.cpp at line 167
#if NIX_VERSION >= 0x021900void putFile(const Input &input, const CanonPath &path, std::string_view contents, std::optional<std::string> commitMsg) const override{auto root = getSourcePath(input);assert(root);#if NIX_VERSION >= 0x022100writeFile((CanonPath(*root) / path).abs(), contents);#elsewriteFile((CanonPath(*root) + path).abs(), contents);#endifrunPijul({"add", "--", std::string(path.rel())}, root); - edit in src/fetcher.cpp at line 182
if (commitMsg)runPijul({"record", std::string(path.rel()), "-m", *commitMsg}, root, {}, true);}#else - replacement in src/fetcher.cpp at line 188
auto sourcePath = getSourcePath(input);assert(sourcePath);auto root = getSourcePath(input);assert(root); - replacement in src/fetcher.cpp at line 191
runPijul({"add", "--", std::string(file)}, sourcePath);runPijul({"add", "--", std::string(file)}, root); - replacement in src/fetcher.cpp at line 194
runPijul({"record", std::string(file), "-m", *commitMsg}, sourcePath, {}, true);runPijul({"record", std::string(file), "-m", *commitMsg}, root, {}, true);}#endif#if NIX_VERSION >= 0x021900std::string_view schemeName() const override{return "pijul"sv;}StringSet allowedAttrs() const override{return {"url"s, "channel"s, "state"s, "narHash"s, "lastModified"s};}#endif#if NIX_VERSION >= 0x022100bool isLocked(const Input &input) const override{return maybeGetStrAttr(input.attrs, "channel") && maybeGetStrAttr(input.attrs, "state");}std::pair<ref<InputAccessor>, Input> getAccessor(ref<Store> store, const Input &_input) const override{Input input(_input);auto [storePath, _] = fetchToStore(store, input);return {makeStorePathAccessor(store, storePath), input}; - edit in src/fetcher.cpp at line 224
#endif - replacement in src/fetcher.cpp at line 233
static std::pair<StorePath, Attrs> doFetch(const ref<Store> &store, const Input &input)static std::pair<StorePath, Attrs> doFetch(const ref<Store> &_store, const Input &input) - edit in src/fetcher.cpp at line 235
#if NIX_VERSION >= 0x022000Store &store = *_store;#elseconst auto &store = _store;#endif - replacement in src/fetcher.cpp at line 281
auto [storePath, rs] = doFetch(store, name, repoUrl, channel, state);auto [storePath, rs] = doFetch(_store, name, repoUrl, channel, state); - edit in src/fetcher.cpp at line 350
#if NIX_VERSION >= 0x022100auto [accessor, canonPath] = PosixSourceAccessor::createAtRoot(repoDir);auto storePath = store->addToStore(inputName, accessor, canonPath);#elif NIX_VERSION >= 0x022000PosixSourceAccessor accessor;auto storePath = store->addToStore(inputName, accessor, CanonPath::fromCwd(repoDir));#else - edit in src/fetcher.cpp at line 358
#endif - edit in src/fetcher.cpp at line 413
#if NIX_VERSION >= 0x022000PosixSourceAccessor accessor;auto storePath = store->addToStore(input.getName(), accessor, CanonPath{actualPath}, FileIngestionMethod::Recursive, HashAlgorithm::SHA256, {}, filter);#else - edit in src/fetcher.cpp at line 418
#endif