Compare commits

..
Author SHA1 Message Date
John Ericson f717a37448 Convert some more Path 2026-02-16 15:08:07 -05:00
John Ericson 017327eeb3 No Path in libutil
But the definition is still kept for downstream
2026-02-16 15:07:43 -05:00
siddhantCodes 7ef1b1cc82 Convert more end exes 2 2026-02-16 15:05:23 -05:00
siddhantCodes 37a84d424b Convert more end exes 2026-02-16 15:04:50 -05:00
John Ericson 0749ec4e55 Merge pull request #15230 from obsidiansystems/new-wine
flake: Use Wine 11 for running mingw tests
2026-02-15 16:41:52 +00:00
Artemis Tosini 4cc97150df flake: Use Wine 11 for running mingw tests
Set wine_11 as the emulator for Windows.
2026-02-15 10:56:02 -05:00
John Ericson 2bbd1094a2 flake.lock: Update Nixpkgs
Flake lock file updates:

• Updated input 'nixpkgs':
    'https://releases.nixos.org/nixos/25.11/nixos-25.11.4506.078d69f03934/nixexprs.tar.xz?narHash=sha256-Xu%2B7iYcAuOvsI2wdkUcIEmkqEJbvvE6n7qR9QNjJyP4%3D' (2026-01-22)
  → 'https://releases.nixos.org/nixos/25.11/nixos-25.11.5960.3aadb7ca9eac/nixexprs.tar.xz?narHash=sha256-WoiezqWJQ3OHILah%2Bp6rzNXdJceEAmAhyDFZFZ6pZzY%3D' (2026-02-14)

This will be needed to get Wine 11.
2026-02-15 10:53:15 -05:00
John Ericson 95251a51dd Merge pull request #15241 from obsidiansystems/fix-isindir
libutil: fix `isInDir` rejecting paths starting with dot
2026-02-15 15:52:37 +00:00
John Ericson 02d9f4ecb4 Merge pull request #15239 from xokdvium/fix-warnings-no-intereference-size
meson: Only enable -Wno-interference-size with GCC
2026-02-15 15:06:54 +00:00
John Ericson 3269c71e9d Merge pull request #15240 from xokdvium/fix-mtls-redirect-test
libstore-tests: Fix mTLS test for redirect, correctly propagate tries
2026-02-15 15:04:50 +00:00
Amaan Qureshi ad0055e67c libutil: fix isInDir rejecting paths starting with dot
The old check rejected any relative path whose first character was a
dot, producing false negatives for valid descendants like `.ssh` or
`.config`. This commit changes the logic such that now it inspects the
first path component via `path::begin()`, only rejects `.` and `..`
rather than anything dot-prefixed. Fixes #15207.
2026-02-15 10:04:08 -05:00
Sergei Zimmerman d3d63a4b5b libstore-tests: Fix mTLS test for redirect, correctly propagate tries
The fake cacert didn't have subjectAltName for 127.0.0.1, so the test
was failing for a different reason. Also `tries` setting wasn't being respected.
There's no callsite specifying it in the request, so just use the one specified
in the FileTransferSettings and remove the fields from the FileTransferRequest.
2026-02-15 00:08:21 +03:00
Sergei Zimmerman 6a5ee08737 meson: Only enable -Wno-interference-size with GCC
Clang doesn't recognise this option.
2026-02-14 23:42:28 +03:00
201 changed files with 971 additions and 1268 deletions

No files matched your search

Generated
+4 -4
View File
@@ -63,11 +63,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1769089682,
"narHash": "sha256-Xu+7iYcAuOvsI2wdkUcIEmkqEJbvvE6n7qR9QNjJyP4=",
"rev": "078d69f03934859a181e81ba987c2bb033eebfc5",
"lastModified": 1771043024,
"narHash": "sha256-WoiezqWJQ3OHILah+p6rzNXdJceEAmAhyDFZFZ6pZzY=",
"rev": "3aadb7ca9eac2891d52a9dec199d9580a6e2bf44",
"type": "tarball",
"url": "https://releases.nixos.org/nixos/25.11/nixos-25.11.4506.078d69f03934/nixexprs.tar.xz"
"url": "https://releases.nixos.org/nixos/25.11/nixos-25.11.5960.3aadb7ca9eac/nixexprs.tar.xz"
},
"original": {
"type": "tarball",
+3
View File
@@ -115,6 +115,9 @@
}
// lib.optionalAttrs (crossSystem == "x86_64-unknown-freebsd13") {
useLLVM = true;
}
// lib.optionalAttrs (crossSystem == "x86_64-w64-mingw32") {
emulator = pkgs: "${pkgs.buildPackages.wineWow64Packages.stable_11}/bin/wine";
};
overlays = [
(overlayFor (pkgs: pkgs.${stdenv}))
+7 -1
View File
@@ -27,13 +27,19 @@ add_project_arguments(
'-Wignored-qualifiers',
'-Wimplicit-fallthrough',
'-Wno-deprecated-declarations',
'-Wno-interference-size', # Used for C++ ABI only. We don't provide any guarantees about different march tunings.
language : 'cpp',
)
# GCC doesn't benefit much from precompiled headers.
do_pch = cxx.get_id() == 'clang'
if cxx.get_id() == 'gcc'
add_project_arguments(
'-Wno-interference-size', # Used for C++ ABI only. We don't provide any guarantees about different march tunings.
language : 'cpp',
)
endif
# This is a clang-only option for improving build times.
# It forces the instantiation of templates in the PCH itself and
# not every translation unit it's included in.
+4 -5
View File
@@ -4,7 +4,6 @@
#include "nix/cmd/command.hh"
#include "nix/cmd/legacy.hh"
#include "nix/cmd/markdown.hh"
#include "nix/main/shared.hh"
#include "nix/store/globals.hh"
#include "nix/store/store-open.hh"
#include "nix/store/local-fs-store.hh"
@@ -76,7 +75,7 @@ ref<StoreConfig> StoreConfigCommand::getStoreConfig()
ref<StoreConfig> StoreConfigCommand::createStoreConfig()
{
return resolveStoreConfig(settings, StoreReference{settings.storeUri.get()});
return resolveStoreConfig(StoreReference{settings.storeUri.get()});
}
void StoreConfigCommand::run()
@@ -130,7 +129,7 @@ CopyCommand::CopyCommand()
ref<StoreConfig> CopyCommand::createStoreConfig()
{
return !srcUri ? StoreCommand::createStoreConfig() : resolveStoreConfig(settings, StoreReference{*srcUri});
return !srcUri ? StoreCommand::createStoreConfig() : resolveStoreConfig(StoreReference{*srcUri});
}
ref<Store> CopyCommand::getDstStore()
@@ -138,7 +137,7 @@ ref<Store> CopyCommand::getDstStore()
if (!srcUri && !dstUri)
throw UsageError("you must pass '--from' and/or '--to'");
return !dstUri ? openStore(settings) : openStore(settings, StoreReference{*dstUri});
return !dstUri ? openStore() : openStore(StoreReference{*dstUri});
}
EvalCommand::EvalCommand()
@@ -160,7 +159,7 @@ EvalCommand::~EvalCommand()
ref<Store> EvalCommand::getEvalStore()
{
if (!evalStore)
evalStore = evalStoreUrl ? openStore(settings, StoreReference{*evalStoreUrl}) : getStore();
evalStore = evalStoreUrl ? openStore(StoreReference{*evalStoreUrl}) : getStore();
return ref<Store>(evalStore);
}
+3 -3
View File
@@ -19,12 +19,12 @@
namespace nix {
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
static GlobalConfig::Register rFetchSettings(&fetchSettings);
EvalSettings evalSettings{
settings,
settings.readOnlyMode,
{
{
"flake",
@@ -135,7 +135,7 @@ MixEvalArgs::MixEvalArgs()
fetchers::overrideRegistry(from.input, to.input, extraAttrs);
}},
.completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) {
completeFlakeRef(completions, openStore(settings), prefix);
completeFlakeRef(completions, openStore(), prefix);
}},
});
+2 -2
View File
@@ -4,9 +4,9 @@
namespace nix {
std::string fetchBuildLog(Settings & settings, ref<Store> store, const StorePath & path, std::string_view what)
std::string fetchBuildLog(ref<Store> store, const StorePath & path, std::string_view what)
{
auto subs = getDefaultSubstituters(settings);
auto subs = getDefaultSubstituters();
subs.push_front(store);
+2 -2
View File
@@ -407,7 +407,7 @@ void createOutLinks(const std::filesystem::path & outLink, const BuiltPaths & bu
struct MixOutLinkBase : virtual Args
{
/** Prefix for any output symlinks. Empty means do not write an output symlink. */
Path outLink;
std::filesystem::path outLink;
MixOutLinkBase(const std::string & defaultOutLink)
: outLink(defaultOutLink)
@@ -435,7 +435,7 @@ struct MixOutLinkByDefault : MixOutLinkBase, virtual Args
addFlag({
.longName = "no-link",
.description = "Do not create symlinks to the build results.",
.handler = {&outLink, Path("")},
.handler = {&outLink, std::filesystem::path{}},
});
}
};
+1 -3
View File
@@ -8,8 +8,6 @@
namespace nix {
class Settings;
/**
* Fetch the build log for a store path, searching the store and its
* substituters.
@@ -20,6 +18,6 @@ class Settings;
* @return The build log content.
* @throws Error if the build log is not available.
*/
std::string fetchBuildLog(Settings & settings, ref<Store> store, const StorePath & path, std::string_view what);
std::string fetchBuildLog(ref<Store> store, const StorePath & path, std::string_view what);
} // namespace nix
@@ -1,6 +1,7 @@
#pragma once
///@file
#include "nix/store/globals.hh"
#include "nix/cmd/installable-value.hh"
#include "nix/store/outputs-spec.hh"
#include "nix/cmd/command.hh"
+1 -1
View File
@@ -157,7 +157,7 @@ MixFlakeOptions::MixFlakeOptions()
.category = category,
.labels = {"flake-lock-path"},
.handler = {[&](std::string lockFilePath) {
lockFlags.referenceLockFilePath = {getFSSourceAccessor(), CanonPath(absPath(lockFilePath))};
lockFlags.referenceLockFilePath = {getFSSourceAccessor(), CanonPath(absPath(lockFilePath).string())};
}},
.completer = completePath,
});
+1 -1
View File
@@ -113,7 +113,7 @@ ReadlineLikeInteracter::Guard ReadlineLikeInteracter::init(detail::ReplCompleter
// Allow nix-repl specific settings in .inputrc
rl_readline_name = "nix-repl";
try {
createDirs(dirOf(historyFile));
createDirs(std::filesystem::path(historyFile).parent_path());
} catch (SystemError & e) {
logWarning(e.info());
}
+1 -1
View File
@@ -564,7 +564,7 @@ ProcessLineResult NixRepl::processLine(std::string line)
settings.readOnlyMode = true;
Finally roModeReset([&]() { settings.readOnlyMode = false; });
RunPager pager;
auto log = fetchBuildLog(settings, state->store, drvPath, drvPathRaw);
auto log = fetchBuildLog(state->store, drvPath, drvPathRaw);
logger->writeToStdout(log);
} else {
runNix("nix-shell", {drvPathRaw});
+5 -3
View File
@@ -132,8 +132,9 @@ nix_eval_state_builder * nix_eval_state_builder_new(nix_c_context * context, Sto
return unsafe_new_with_self<nix_eval_state_builder>([&](auto * self) {
return nix_eval_state_builder{
.store = nix::ref<nix::Store>(store->ptr),
.settings = nix::EvalSettings{cStoreSettings},
.fetchSettings = nix::fetchers::Settings{cStoreSettings},
.settings = nix::EvalSettings{/* &bool */ self->readOnlyMode},
.fetchSettings = nix::fetchers::Settings{},
.readOnlyMode = true,
};
});
}
@@ -152,7 +153,8 @@ nix_err nix_eval_state_builder_load(nix_c_context * context, nix_eval_state_buil
if (context)
context->last_err_code = NIX_OK;
try {
loadConfFile(cStoreSettings);
// TODO: load in one go?
builder->settings.readOnlyMode = nix::settings.readOnlyMode;
loadConfFile(builder->settings);
loadConfFile(builder->fetchSettings);
}
+2
View File
@@ -16,6 +16,8 @@ struct nix_eval_state_builder
nix::EvalSettings settings;
nix::fetchers::Settings fetchSettings;
nix::LookupPath lookupPath;
// TODO: make an EvalSettings setting own this instead?
bool readOnlyMode;
};
struct EvalState
@@ -26,18 +26,18 @@ public:
}
protected:
LibExprTest(auto && makeEvalSettings, auto &&... args)
: LibStoreTest(args...)
, evalSettings(makeEvalSettings(settings))
LibExprTest(ref<Store> store, auto && makeEvalSettings)
: LibStoreTest()
, evalSettings(makeEvalSettings(readOnlyMode))
, state({}, store, fetchSettings, evalSettings, nullptr)
{
}
LibExprTest()
: LibExprTest([](Settings & settings) {
EvalSettings evalSettings{settings};
evalSettings.nixPath = {};
return evalSettings;
: LibExprTest(openStore("dummy://"), [](bool & readOnlyMode) {
EvalSettings settings{readOnlyMode};
settings.nixPath = {};
return settings;
})
{
}
@@ -66,8 +66,8 @@ protected:
}
bool readOnlyMode = true;
fetchers::Settings fetchSettings{settings};
EvalSettings evalSettings{settings};
fetchers::Settings fetchSettings{};
EvalSettings evalSettings{readOnlyMode};
EvalState state;
};
+6 -9
View File
@@ -179,15 +179,12 @@ class PureEvalTest : public LibExprTest
{
public:
PureEvalTest()
: LibExprTest{
[](auto & settings) {
EvalSettings evalSettings{settings};
evalSettings.pureEval = true;
evalSettings.restrictEval = true;
return evalSettings;
},
[](auto & settings) { return openStore(settings, "dummy://", {{"read-only", "false"}}); },
}
: LibExprTest(openStore("dummy://", {{"read-only", "false"}}), [](bool & readOnlyMode) {
EvalSettings settings{readOnlyMode};
settings.pureEval = true;
settings.restrictEval = true;
return settings;
})
{
}
};
+7 -9
View File
@@ -63,19 +63,19 @@ struct AttrDb
SymbolTable & symbols;
AttrDb(bool useSQLiteWAL, const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
AttrDb(const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
: cfg(cfg)
, _state(std::make_unique<Sync<State>>())
, symbols(symbols)
{
auto state(_state->lock());
auto cacheDir = std::filesystem::path(getCacheDir()) / "eval-cache-v6";
auto cacheDir = getCacheDir() / "eval-cache-v6";
createDirs(cacheDir);
auto dbPath = cacheDir / (fingerprint.to_string(HashFormat::Base16, false) + ".sqlite");
state->db = SQLite(dbPath, {.useWAL = useSQLiteWAL});
state->db = SQLite(dbPath, {.useWAL = settings.useSQLiteWAL});
state->db.isCache();
state->db.exec(schema);
@@ -287,11 +287,10 @@ struct AttrDb
}
};
static std::shared_ptr<AttrDb>
makeAttrDb(bool useSQLiteWAL, const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
static std::shared_ptr<AttrDb> makeAttrDb(const StoreDirConfig & cfg, const Hash & fingerprint, SymbolTable & symbols)
{
try {
return std::make_shared<AttrDb>(useSQLiteWAL, cfg, fingerprint, symbols);
return std::make_shared<AttrDb>(cfg, fingerprint, symbols);
} catch (SQLiteError &) {
ignoreExceptionExceptInterrupt();
return nullptr;
@@ -300,8 +299,7 @@ makeAttrDb(bool useSQLiteWAL, const StoreDirConfig & cfg, const Hash & fingerpri
EvalCache::EvalCache(
std::optional<std::reference_wrapper<const Hash>> useCache, EvalState & state, RootLoader rootLoader)
: db(useCache ? makeAttrDb(state.store->config.settings.useSQLiteWAL, *state.store, *useCache, state.symbols)
: nullptr)
: db(useCache ? makeAttrDb(*state.store, *useCache, state.symbols) : nullptr)
, state(state)
, rootLoader(rootLoader)
{
@@ -709,7 +707,7 @@ StorePath AttrCursor::forceDerivation()
auto aDrvPath = getAttr(root->state.s.drvPath);
auto drvPath = root->state.store->parseStorePath(aDrvPath->getString());
drvPath.requireDerivation();
if (!root->state.store->isValidPath(drvPath) && !root->state.store->config.settings.readOnlyMode) {
if (!root->state.store->isValidPath(drvPath) && !settings.readOnlyMode) {
/* The eval cache contains 'drvPath', but the actual path has
been garbage-collected. So force it to be regenerated. */
aDrvPath->forceValue();
+7
View File
@@ -1,9 +1,16 @@
#include "nix/expr/eval-error.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/value.hh"
#include "nix/store/store-api.hh"
namespace nix {
InvalidPathError::InvalidPathError(EvalState & state, const StorePath & path)
: EvalError(state, "path '%s' is not valid", state.store->printStorePath(path))
, path{path}
{
}
template<class T>
EvalErrorBuilder<T> & EvalErrorBuilder<T>::withExitStatus(unsigned int exitStatus)
{
+6 -6
View File
@@ -48,8 +48,8 @@ Strings EvalSettings::parseNixPath(const std::string & s)
return res;
}
EvalSettings::EvalSettings(nix::Settings & storeSettings, EvalSettings::LookupPathHooks lookupPathHooks)
: storeSettings{storeSettings}
EvalSettings::EvalSettings(bool & readOnlyMode, EvalSettings::LookupPathHooks lookupPathHooks)
: readOnlyMode{readOnlyMode}
, lookupPathHooks{lookupPathHooks}
{
auto var = getEnv("NIX_ABORT_ON_WARN");
@@ -57,7 +57,7 @@ EvalSettings::EvalSettings(nix::Settings & storeSettings, EvalSettings::LookupPa
builtinsAbortOnWarn = true;
}
Strings EvalSettings::getDefaultNixPath(nix::Settings & settings)
Strings EvalSettings::getDefaultNixPath()
{
Strings res;
auto add = [&](const std::filesystem::path & p, const std::string & s = std::string()) {
@@ -70,7 +70,7 @@ Strings EvalSettings::getDefaultNixPath(nix::Settings & settings)
}
};
add(std::filesystem::path{getNixDefExpr(settings)} / "channels");
add(getNixDefExpr() / "channels");
auto profilesDirOpts = settings.getProfileDirsOptions();
add(rootChannelsDir(profilesDirOpts) / "nixpkgs", "nixpkgs");
add(rootChannelsDir(profilesDirOpts));
@@ -101,10 +101,10 @@ std::string EvalSettings::resolvePseudoUrl(std::string_view url)
const std::string & EvalSettings::getCurrentSystem() const
{
const auto & evalSystem = currentSystem.get();
return evalSystem != "" ? evalSystem : storeSettings.thisSystem.get();
return evalSystem != "" ? evalSystem : settings.thisSystem.get();
}
std::filesystem::path getNixDefExpr(const Settings & settings)
std::filesystem::path getNixDefExpr()
{
return settings.useXDGBaseDirectories ? getStateDir() / "defexpr" : getHome() / ".nix-defexpr";
}
+3 -4
View File
@@ -15,7 +15,6 @@
#include "nix/store/filetransfer.hh"
#include "nix/expr/function-trace.hh"
#include "nix/store/profiles.hh"
#include "nix/store/globals.hh"
#include "nix/expr/print.hh"
#include "nix/fetchers/filtering-source-accessor.hh"
#include "nix/util/memory-source-accessor.hh"
@@ -331,7 +330,7 @@ EvalState::EvalState(
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
}
if (!settings.restrictEval) {
for (auto & i : EvalSettings::getDefaultNixPath(store->config.settings)) {
for (auto & i : EvalSettings::getDefaultNixPath()) {
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
}
}
@@ -433,7 +432,7 @@ void EvalState::checkURI(const std::string & uri)
/* If the URI is a path, then check it against allowedPaths as
well. */
if (isAbsolute(uri)) {
if (std::filesystem::path(uri).is_absolute()) {
if (auto rootFS2 = rootFS.dynamic_pointer_cast<AllowListSourceAccessor>())
rootFS2->checkAccess(CanonPath(uri));
return;
@@ -2509,7 +2508,7 @@ StorePath EvalState::copyPathToStore(NixStringContext & context, const SourcePat
fetchSettings,
*store,
path.resolveSymlinks(SymlinkResolution::Ancestors),
settings.storeSettings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
settings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
path.baseName(),
ContentAddressMethod::Raw::NixArchive,
nullptr,
+2 -5
View File
@@ -73,12 +73,9 @@ MakeError(IFDError, EvalBaseError);
struct InvalidPathError : public EvalError
{
public:
Path path;
StorePath path;
InvalidPathError(EvalState & state, const Path & path)
: EvalError(state, "path '%s' is not valid", path)
{
}
InvalidPathError(EvalState & state, const StorePath & path);
};
/**
@@ -9,15 +9,9 @@ namespace nix {
class EvalState;
struct PrimOp;
class Settings;
struct EvalSettings : Config
{
/**
* Reference to the "parent" store-layer settings.
*/
nix::Settings & storeSettings;
/**
* Function used to interpret look path entries of a given scheme.
*
@@ -44,9 +38,11 @@ struct EvalSettings : Config
*/
using LookupPathHooks = std::map<std::string, std::function<LookupPathHook>>;
EvalSettings(nix::Settings & settings, LookupPathHooks lookupPathHooks = {});
EvalSettings(bool & readOnlyMode, LookupPathHooks lookupPathHooks = {});
static Strings getDefaultNixPath(nix::Settings & settings);
bool & readOnlyMode;
static Strings getDefaultNixPath();
static bool isPseudoUrl(std::string_view s);
@@ -370,6 +366,6 @@ struct EvalSettings : Config
/**
* Conventionally part of the default nix path in impure mode.
*/
std::filesystem::path getNixDefExpr(const Settings & settings);
std::filesystem::path getNixDefExpr();
} // namespace nix
+2 -1
View File
@@ -388,7 +388,8 @@ path_start
});
}
Path path(absPath(literal, state->basePath.path.abs()));
auto basePath = std::filesystem::path(state->basePath.path.abs());
Path path(absPath(literal, &basePath).string());
/* add back in the trailing '/' to the first segment */
if (literal.size() > 1 && literal.back() == '/')
path += '/';
+1 -1
View File
@@ -12,7 +12,7 @@ SourcePath EvalState::rootPath(CanonPath path)
SourcePath EvalState::rootPath(PathView path)
{
return {rootFS, CanonPath(absPath(path))};
return {rootFS, CanonPath(absPath(std::filesystem::path{path}).string())};
}
SourcePath EvalState::storePath(const StorePath & path)
+41 -43
View File
@@ -74,7 +74,7 @@ StringMap EvalState::realiseContext(const NixStringContext & context, StorePathS
for (auto & c : context) {
auto ensureValid = [&](const StorePath & p) {
if (!store->isValidPath(p))
error<InvalidPathError>(store->printStorePath(p)).debugThrow();
error<InvalidPathError>(p).debugThrow();
};
std::visit(
overloaded{
@@ -503,7 +503,7 @@ void prim_exec(EvalState & state, const PosIdx pos, Value ** args, Value & v)
try {
auto _ = state.realiseContext(context); // FIXME: Handle CA derivations
} catch (InvalidPathError & e) {
state.error<EvalError>("cannot execute '%1%', since path '%2%' is not valid", program, e.path)
state.error<EvalError>("cannot execute '%1%', since path '%2%' is not valid", program, e.path.to_string())
.atPos(pos)
.debugThrow();
}
@@ -1819,8 +1819,8 @@ static void derivationStrictInternal(EvalState & state, std::string_view drvName
Unless we are in read-only mode, that is, in which case we do not
write anything. Users commonly do this to speed up evaluation in
contexts where they don't actually want to build anything. */
auto drvPath = state.settings.storeSettings.readOnlyMode ? computeStorePath(*state.store, drv)
: state.store->writeDerivation(drv, state.repair);
auto drvPath =
settings.readOnlyMode ? computeStorePath(*state.store, drv) : state.store->writeDerivation(drv, state.repair);
auto drvPathS = state.store->printStorePath(drvPath);
printMsg(lvlChatty, "instantiated '%1%' -> '%2%'", drvName, drvPathS);
@@ -1931,11 +1931,11 @@ static void prim_storePath(EvalState & state, const PosIdx pos, Value ** args, V
directly in the store. The latter condition is necessary so
e.g. nix-push does the right thing. */
if (!state.store->isStorePath(path.abs()))
path = CanonPath(canonPath(path.abs(), true));
path = CanonPath(canonPath(path.abs(), true).string());
if (!state.store->isInStore(path.abs()))
state.error<EvalError>("path '%1%' is not in the Nix store", path).atPos(pos).debugThrow();
auto path2 = state.store->toStorePath(path.abs()).first;
if (!state.settings.storeSettings.readOnlyMode)
if (!settings.readOnlyMode)
state.store->ensurePath(path2);
context.insert(NixStringContextElem::Opaque{.path = path2});
v.mkString(path.abs(), context, state.mem);
@@ -2152,7 +2152,7 @@ static void prim_findFile(EvalState & state, const PosIdx pos, Value ** args, Va
auto rewrites = state.realiseContext(context);
path = rewriteStrings(std::move(path), rewrites);
} catch (InvalidPathError & e) {
state.error<EvalError>("cannot find '%1%', since path '%2%' is not valid", path, e.path)
state.error<EvalError>("cannot find '%1%', since path '%2%' is not valid", path, state.store->printStorePath(e.path))
.atPos(pos)
.debugThrow();
}
@@ -2676,24 +2676,23 @@ static void prim_toFile(EvalState & state, const PosIdx pos, Value ** args, Valu
.debugThrow();
}
auto storePath = state.settings.storeSettings.readOnlyMode
? state.store->makeFixedOutputPathFromCA(
name,
TextInfo{
.hash = hashString(HashAlgorithm::SHA256, contents),
.references = std::move(refs),
})
: ({
StringSource s{contents};
state.store->addToStoreFromDump(
s,
name,
FileSerialisationMethod::Flat,
ContentAddressMethod::Raw::Text,
HashAlgorithm::SHA256,
refs,
state.repair);
});
auto storePath = settings.readOnlyMode ? state.store->makeFixedOutputPathFromCA(
name,
TextInfo{
.hash = hashString(HashAlgorithm::SHA256, contents),
.references = std::move(refs),
})
: ({
StringSource s{contents};
state.store->addToStoreFromDump(
s,
name,
FileSerialisationMethod::Flat,
ContentAddressMethod::Raw::Text,
HashAlgorithm::SHA256,
refs,
state.repair);
});
/* Note: we don't need to add `context' to the context of the
result, since `storePath' itself has references to the paths
@@ -2837,24 +2836,23 @@ static void addPath(
if (!expectedHash || !state.store->isValidPath(*expectedStorePath)) {
// FIXME: support refs in fetchToStore()?
auto dstPath = refs.empty()
? fetchToStore(
state.fetchSettings,
*state.store,
path.resolveSymlinks(),
state.settings.storeSettings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
name,
method,
filter.get(),
state.repair)
: state.store->addToStore(
name,
path.resolveSymlinks(),
method,
HashAlgorithm::SHA256,
refs,
filter ? *filter.get() : defaultPathFilter,
state.repair);
auto dstPath = refs.empty() ? fetchToStore(
state.fetchSettings,
*state.store,
path.resolveSymlinks(),
settings.readOnlyMode ? FetchMode::DryRun : FetchMode::Copy,
name,
method,
filter.get(),
state.repair)
: state.store->addToStore(
name,
path.resolveSymlinks(),
method,
HashAlgorithm::SHA256,
refs,
filter ? *filter.get() : defaultPathFilter,
state.repair);
if (expectedHash && expectedStorePath != dstPath)
state.error<EvalError>("store path mismatch in (possibly filtered) path added from '%s'", path)
.atPos(pos)
+1 -1
View File
@@ -271,7 +271,7 @@ static void prim_appendContext(EvalState & state, const PosIdx pos, Value ** arg
if (!state.store->isStorePath(name))
state.error<EvalError>("context key '%s' is not a store path", name).atPos(i.pos).debugThrow();
auto namePath = state.store->parseStorePath(name);
if (!state.settings.storeSettings.readOnlyMode)
if (!settings.readOnlyMode)
state.store->ensurePath(namePath);
state.forceAttrs(*i.value, i.pos, "while evaluating the value of a string context");
+1 -1
View File
@@ -209,7 +209,7 @@ static void prim_fetchClosure(EvalState & state, const PosIdx pos, Value ** args
{.msg = HintFmt("'fetchClosure' does not support URL query parameters (in '%s')", *fromStoreUrl),
.pos = state.positions[pos]});
auto fromStore = openStore(state.settings.storeSettings, std::move(storeRef));
auto fromStore = openStore(std::move(storeRef));
if (toPath)
runFetchClosureWithRewrite(state, pos, *fromStore, *fromPath, *toPath, v);
+1 -2
View File
@@ -1,14 +1,13 @@
#include "nix_api_fetchers.h"
#include "nix_api_fetchers_internal.hh"
#include "nix_api_util_internal.h"
#include "nix_api_store_internal.h"
extern "C" {
nix_fetchers_settings * nix_fetchers_settings_new(nix_c_context * context)
{
try {
auto fetchersSettings = nix::make_ref<nix::fetchers::Settings>(nix::fetchers::Settings{cStoreSettings});
auto fetchersSettings = nix::make_ref<nix::fetchers::Settings>(nix::fetchers::Settings{});
return new nix_fetchers_settings{
.settings = fetchersSettings,
};
+7 -16
View File
@@ -1,12 +1,9 @@
#include <nlohmann/json.hpp>
#include <gtest/gtest.h>
#include "nix/util/json-utils.hh"
#include "nix/store/globals.hh"
#include "nix/fetchers/fetchers.hh"
#include "nix/fetchers/fetch-settings.hh"
#include "nix/store/tests/test-main.hh"
#include "nix/util/json-utils.hh"
#include "nix/util/tests/characterization.hh"
namespace nix::fetchers {
@@ -28,8 +25,7 @@ public:
TEST_F(AccessKeysTest, singleOrgGitHub)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"github.com/a", "token"});
auto i = Input::fromURL(fetchSettings, "github:a/b");
@@ -39,8 +35,7 @@ TEST_F(AccessKeysTest, singleOrgGitHub)
TEST_F(AccessKeysTest, nonMatches)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"github.com", "token"});
auto i = Input::fromURL(fetchSettings, "gitlab:github.com/evil");
@@ -50,8 +45,7 @@ TEST_F(AccessKeysTest, nonMatches)
TEST_F(AccessKeysTest, noPartialMatches)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"github.com/partial", "token"});
auto i = Input::fromURL(fetchSettings, "github:partial-match/repo");
@@ -61,8 +55,7 @@ TEST_F(AccessKeysTest, noPartialMatches)
TEST_F(AccessKeysTest, repoGitHub)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"github.com", "token"});
fetchSettings.accessTokens.get().insert({"github.com/a/b", "another_token"});
fetchSettings.accessTokens.get().insert({"github.com/a/c", "yet_another_token"});
@@ -80,8 +73,7 @@ TEST_F(AccessKeysTest, repoGitHub)
TEST_F(AccessKeysTest, multipleGitLab)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"gitlab.com", "token"});
fetchSettings.accessTokens.get().insert({"gitlab.com/a/b", "another_token"});
auto i = Input::fromURL(fetchSettings, "gitlab:a/b");
@@ -95,8 +87,7 @@ TEST_F(AccessKeysTest, multipleGitLab)
TEST_F(AccessKeysTest, multipleSourceHut)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings = fetchers::Settings{settings};
fetchers::Settings fetchSettings = fetchers::Settings{};
fetchSettings.accessTokens.get().insert({"git.sr.ht", "token"});
fetchSettings.accessTokens.get().insert({"git.sr.ht/~a/b", "another_token"});
auto i = Input::fromURL(fetchSettings, "sourcehut:a/b");
+4 -8
View File
@@ -5,8 +5,6 @@
#include "nix/fetchers/fetchers.hh"
#include "nix/fetchers/git-utils.hh"
#include "nix/store/tests/test-main.hh"
#include <git2.h>
#include <gtest/gtest.h>
@@ -182,15 +180,13 @@ TEST_F(GitTest, submodulePeriodSupport)
// 6) Commit the addition in super
commitAll(super.get(), "Add submodule with branch='.'");
auto settings = getTestSettings();
auto store = [&] {
auto cfg = make_ref<DummyStoreConfig>(settings, StoreReference::Params{});
auto store = [] {
auto cfg = make_ref<DummyStoreConfig>(StoreReference::Params{});
cfg->readOnly = false;
return cfg->openStore();
}();
auto fetchSettings = fetchers::Settings{settings};
auto settings = fetchers::Settings{};
auto input = fetchers::Input::fromAttrs(
settings,
{
@@ -200,7 +196,7 @@ TEST_F(GitTest, submodulePeriodSupport)
{"ref", "main"},
});
auto [accessor, i] = input.getAccessor(fetchSettings, *store);
auto [accessor, i] = input.getAccessor(settings, *store);
ASSERT_EQ(accessor->readFile(CanonPath("deps/sub/lib.txt")), "hello from submodule\n");
}
+1 -6
View File
@@ -1,11 +1,7 @@
#include "nix/store/globals.hh"
#include "nix/fetchers/fetch-settings.hh"
#include "nix/fetchers/attrs.hh"
#include "nix/fetchers/fetchers.hh"
#include "nix/store/tests/test-main.hh"
#include <gtest/gtest.h>
#include <string>
@@ -27,8 +23,7 @@ class InputFromAttrsTest : public ::testing::WithParamInterface<InputFromAttrsTe
TEST_P(InputFromAttrsTest, attrsAreCorrectAndRoundTrips)
{
auto settings = getTestSettings();
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
const auto & testCase = GetParam();
+3 -3
View File
@@ -44,10 +44,10 @@ struct CacheImpl : Cache
{
auto state(_state.lock());
auto dbPath = (getCacheDir() / "fetcher-cache-v4.sqlite").string();
createDirs(dirOf(dbPath));
auto dbPath = getCacheDir() / "fetcher-cache-v4.sqlite";
createDirs(dbPath.parent_path());
state->db = SQLite(dbPath, {.useWAL = settings.storeSettings.useSQLiteWAL});
state->db = SQLite(dbPath, {.useWAL = nix::settings.useSQLiteWAL});
state->db.isCache();
state->db.exec(schema);
+1 -4
View File
@@ -2,9 +2,6 @@
namespace nix::fetchers {
Settings::Settings(const nix::Settings & storeSettings)
: storeSettings(storeSettings)
{
}
Settings::Settings() {}
} // namespace nix::fetchers
+2 -2
View File
@@ -76,8 +76,8 @@ std::pair<StorePath, Hash> fetchToStore2(
auto [storePath, hash] =
mode == FetchMode::DryRun
? [&]() {
auto [storePath, hash] = store.computeStorePath(
store.config.settings, name, path, method, HashAlgorithm::SHA256, {}, filter2);
auto [storePath, hash] =
store.computeStorePath(name, path, method, HashAlgorithm::SHA256, {}, filter2);
debug(
"hashed '%s' to '%s' (hash '%s')",
path,
+2 -2
View File
@@ -268,10 +268,10 @@ void Fetch::fetch(
return;
}
std::filesystem::path cacheDir = getCacheDir() / "git-lfs";
auto cacheDir = getCacheDir() / "git-lfs";
std::string key = hashString(HashAlgorithm::SHA256, pointerFilePath.rel()).to_string(HashFormat::Base16, false)
+ "/" + pointer->oid;
std::filesystem::path cachePath = cacheDir / key;
auto cachePath = cacheDir / key;
if (pathExists(cachePath)) {
debug("using cache entry %s -> %s", key, PathFmt(cachePath));
sink(readFile(cachePath));
+1 -1
View File
@@ -666,7 +666,7 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
.program = "git",
.args =
{"-c",
"gpg.ssh.allowedSignersFile=" + allowedSignersFile,
"gpg.ssh.allowedSignersFile=" + allowedSignersFile.string(),
"-C",
path.string(),
"verify-commit",
+4 -3
View File
@@ -44,8 +44,9 @@ static bool isCacheFileWithinTtl(const Settings & settings, time_t now, const Po
std::filesystem::path getCachePath(std::string_view key, bool shallow)
{
return getCacheDir() / "gitv3"
/ (hashString(HashAlgorithm::SHA256, key).to_string(HashFormat::Nix32, false) + (shallow ? "-shallow" : ""));
auto name =
hashString(HashAlgorithm::SHA256, key).to_string(HashFormat::Nix32, false) + (shallow ? "-shallow" : "");
return getCacheDir() / "gitv3" / std::move(name);
}
// Returns the name of the HEAD branch.
@@ -629,7 +630,7 @@ struct GitInputScheme : InputScheme
if (url.scheme == "file" && !forceHttp && !isBareRepository(renderUrlPathEnsureLegal(url.path))) {
auto path = renderUrlPathEnsureLegal(url.path);
if (!isAbsolute(path)) {
if (!std::filesystem::path(path).is_absolute()) {
warn(
"Fetching Git repository '%s', which uses a path relative to the current directory. "
"This is not supported and will stop working in a future release. "
@@ -13,10 +13,9 @@
namespace nix {
class Settings;
struct GitRepo;
} // namespace nix
}
namespace nix::fetchers {
@@ -24,12 +23,7 @@ struct Cache;
struct Settings : public Config
{
/**
* Reference to the "parent" store-layer settings.
*/
const nix::Settings & storeSettings;
Settings(const nix::Settings & storeSettings);
Settings();
Setting<StringMap> accessTokens{
this,
+1 -1
View File
@@ -302,7 +302,7 @@ struct MercurialInputScheme : InputScheme
}
}
} else {
createDirs(dirOf(cacheDir.string()));
createDirs(cacheDir.parent_path());
runHg({"clone", "--noupdate", "--", actualUrl, cacheDir.string()});
}
}
+2 -2
View File
@@ -117,7 +117,7 @@ struct PathInputScheme : InputScheme
std::optional<std::string> isRelative(const Input & input) const override
{
auto path = getStrAttr(input.attrs, "path");
if (isAbsolute(path))
if (std::filesystem::path(path).is_absolute())
return std::nullopt;
else
return path;
@@ -132,7 +132,7 @@ struct PathInputScheme : InputScheme
{
auto path = getStrAttr(input.attrs, "path");
if (isAbsolute(path))
if (std::filesystem::path(path).is_absolute())
return canonPath(path);
throw Error("cannot fetch input '%s' because it uses a relative path", input.to_string());
+2 -2
View File
@@ -147,13 +147,13 @@ static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, St
return Registry::read(
settings,
[&] -> SourcePath {
if (!isAbsolute(path)) {
if (!std::filesystem::path(path).is_absolute()) {
auto storePath = downloadFile(store, settings, path, "flake-registry.json").storePath;
if (auto store2 = dynamic_cast<LocalFSStore *>(&store))
store2->addPermRoot(storePath, (getCacheDir() / "flake-registry.json").string());
return {store.requireStoreObjectAccessor(storePath)};
} else {
return SourcePath{getFSSourceAccessor(), CanonPath{path}}.resolveSymlinks();
return SourcePath{makeFSSourceAccessor(path)}.resolveSymlinks();
}
}(),
Registry::Global);
+1 -1
View File
@@ -179,7 +179,7 @@ static DownloadTarballResult downloadTarball_(
auto [fdTemp, path] = createTempFile("nix-zipfile");
cleanupTemp.cancel();
cleanupTemp = {path};
debug("downloading '%s' into '%s'...", url, path);
debug("downloading '%s' into %s...", url, PathFmt(path));
{
FdSink sink(fdTemp.get());
source->drainInto(sink);
+1 -1
View File
@@ -13,7 +13,7 @@ struct nix_flake_settings
struct nix_flake_reference_parse_flags
{
std::optional<nix::Path> baseDirectory;
std::optional<std::filesystem::path> baseDirectory;
};
struct nix_flake_reference
+4 -9
View File
@@ -3,7 +3,6 @@
#include <string>
#include <utility>
#include "nix/store/globals.hh"
#include "nix/fetchers/fetch-settings.hh"
#include "nix/flake/flakeref.hh"
#include "nix/fetchers/attrs.hh"
@@ -20,8 +19,7 @@ TEST(parseFlakeRef, path)
{
experimentalFeatureSettings.experimentalFeatures.get().insert(Xp::Flakes);
Settings settings;
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
{
auto s = "/foo/bar";
@@ -71,8 +69,7 @@ TEST(parseFlakeRef, GitArchiveInput)
{
experimentalFeatureSettings.experimentalFeatures.get().insert(Xp::Flakes);
Settings settings;
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
{
auto s = "github:foo/bar/branch%23"; // branch name with `#`
@@ -115,8 +112,7 @@ class InputFromURLTest : public ::testing::WithParamInterface<InputFromURLTestCa
TEST_P(InputFromURLTest, attrsAreCorrectAndRoundTrips)
{
experimentalFeatureSettings.experimentalFeatures.get().insert(Xp::Flakes);
Settings settings;
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
const auto & testCase = GetParam();
@@ -278,8 +274,7 @@ INSTANTIATE_TEST_SUITE_P(
TEST(to_string, doesntReencodeUrl)
{
Settings settings;
fetchers::Settings fetchSettings{settings};
fetchers::Settings fetchSettings;
auto s = "http://localhost:8181/test/+3d.tar.gz";
auto flakeref = parseFlakeRef(fetchSettings, s);
auto unparsed = flakeref.to_string();
+1 -1
View File
@@ -31,7 +31,7 @@ namespace nix::flake {
// setting name -> setting value -> allow or ignore.
typedef std::map<std::string, std::map<std::string, bool>> TrustedList;
std::filesystem::path trustedListPath()
static std::filesystem::path trustedListPath()
{
return getDataDir() / "trusted-settings.json";
}
+14 -8
View File
@@ -121,19 +121,23 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
to 'baseDir'). If so, search upward to the root of the
repo (i.e. the directory containing .git). */
path = absPath(path, baseDir->string(), true);
{
auto baseDirPath = *baseDir;
path = absPath(path, &baseDirPath, true).string();
}
if (isFlake) {
if (!S_ISDIR(lstat(path).st_mode)) {
if (baseNameOf(path) == "flake.nix") {
// Be gentle with people who accidentally write `/foo/bar/flake.nix` instead of `/foo/bar`
auto parentPath = std::filesystem::path(path).parent_path().string();
warn(
"Path '%s' should point at the directory containing the 'flake.nix' file, not the file itself. "
"Pretending that you meant '%s'",
path,
dirOf(path));
path = dirOf(path);
parentPath);
path = parentPath;
} else {
throw BadURL("path '%s' is not a flake (because it's not a directory)", path);
}
@@ -157,7 +161,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
if (lstat(path).st_dev != device)
throw Error("unable to find a flake before encountering filesystem boundary at '%s'", path);
}
path = dirOf(path);
path = std::filesystem::path(path).parent_path().string();
}
if (!found)
throw BadURL("could not find a flake.nix file");
@@ -192,12 +196,12 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
}
subdir = std::string(baseNameOf(flakeRoot)) + (subdir.empty() ? "" : "/" + subdir);
flakeRoot = dirOf(flakeRoot);
flakeRoot = std::filesystem::path(flakeRoot).parent_path().string();
}
}
} else {
if (!preserveRelativePaths && !isAbsolute(path))
if (!preserveRelativePaths && !std::filesystem::path(path).is_absolute())
throw BadURL("flake reference '%s' is not an absolute path", url);
}
@@ -251,8 +255,10 @@ std::optional<std::pair<FlakeRef, std::string>> parseURLFlakeRef(
if (baseDir && (parsed.scheme == "path" || parsed.scheme == "git+file")) {
/* Here we know that the path must not contain encoded '/' or NUL bytes. */
auto path = renderUrlPathEnsureLegal(parsed.path);
if (!isAbsolute(path))
parsed.path = splitString<std::vector<std::string>>(absPath(path, baseDir->string()), "/");
if (!std::filesystem::path(path).is_absolute()) {
auto baseDirPath = *baseDir;
parsed.path = splitString<std::vector<std::string>>(absPath(path, &baseDirPath).string(), "/");
}
}
return fromParsedURL(fetchSettings, std::move(parsed), isFlake);
} catch (BadURL &) {
-1
View File
@@ -8,7 +8,6 @@
#include "nix/main/loggers.hh"
#include "nix/util/util.hh"
#include "nix/main/plugin.hh"
#include "nix/main/shared.hh"
namespace nix {
-7
View File
@@ -13,13 +13,6 @@
namespace nix {
class Settings;
// FIXME: don't use a global variable.
extern Settings settings;
int handleExceptions(const std::string & programName, std::function<void()> fun);
/**
* Don't forget to call initPlugins() after settings are initialized!
* @param loadConfig Whether to load configuration from `nix.conf`, `NIX_CONFIG`, etc. May be disabled for unit tests.
+2 -7
View File
@@ -31,17 +31,12 @@
#include "nix/util/exit.hh"
#include "nix/util/strings.hh"
#include "nix/util/config-global.hh"
#include "main-config-private.hh"
#include "nix/expr/config.hh"
namespace nix {
Settings settings;
static GlobalConfig::Register rSettings(&settings);
char ** savedArgv;
static bool gcWarning = true;
@@ -340,8 +335,8 @@ void printVersion(const std::string & programName)
std::cout << "System configuration file: " << nixConfFile() << "\n";
std::cout << "User configuration files: "
<< os_string_to_string(ExecutablePath{.directories = nixUserConfFiles()}.render()) << "\n";
std::cout << "Store directory: "
<< resolveStoreConfig(settings, StoreReference{settings.storeUri.get()})->storeDir << "\n";
std::cout << "Store directory: " << resolveStoreConfig(StoreReference{settings.storeUri.get()})->storeDir
<< "\n";
std::cout << "State directory: " << settings.nixStateDir << "\n";
}
throw Exit();
+4 -7
View File
@@ -18,9 +18,6 @@
extern "C" {
// FIXME: This is going to conflict with the one in libmain.
nix::Settings cStoreSettings;
nix_err nix_libstore_init(nix_c_context * context)
{
if (context)
@@ -49,7 +46,7 @@ Store * nix_store_open(nix_c_context * context, const char * uri, const char ***
std::string uri_str = uri ? uri : "";
if (uri_str.empty())
return new Store{nix::openStore(cStoreSettings)};
return new Store{nix::openStore()};
auto storeRef = nix::StoreReference::parse(uri_str);
@@ -58,7 +55,7 @@ Store * nix_store_open(nix_c_context * context, const char * uri, const char ***
storeRef.params[params[i][0]] = params[i][1];
}
}
return new Store{nix::openStore(cStoreSettings, std::move(storeRef))};
return new Store{nix::openStore(std::move(storeRef))};
}
NIXC_CATCH_ERRS_NULL
}
@@ -315,8 +312,8 @@ StorePath * nix_add_derivation(nix_c_context * context, Store * store, nix_deriv
without actually writing the derivation if this setting is
set, but it was that way already, so we are doing this for
back-compat for now. */
auto ret = cStoreSettings.readOnlyMode ? nix::computeStorePath(*store->ptr, derivation->drv)
: store->ptr->writeDerivation(derivation->drv, nix::NoRepair);
auto ret = nix::settings.readOnlyMode ? nix::computeStorePath(*store->ptr, derivation->drv)
: store->ptr->writeDerivation(derivation->drv, nix::NoRepair);
return new StorePath{ret};
}
-2
View File
@@ -5,8 +5,6 @@
extern "C" {
extern nix::Settings cStoreSettings;
struct Store
{
nix::ref<nix::Store> ptr;
+7 -7
View File
@@ -1,5 +1,4 @@
#include "nix/store/tests/https-store.hh"
#include "nix/store/tests/test-main.hh"
#include <thread>
@@ -37,9 +36,9 @@ void HttpsBinaryCacheStoreTest::SetUp()
cacheDir = tmpDir / "cache";
delTmpDir = std::make_unique<AutoDelete>(tmpDir);
localCacheStore = make_ref<LocalBinaryCacheStoreConfig>(
settings, "file", cacheDir.string(), LocalBinaryCacheStoreConfig::Params{})
->openStore();
localCacheStore =
make_ref<LocalBinaryCacheStoreConfig>("file", cacheDir.string(), LocalBinaryCacheStoreConfig::Params{})
->openStore();
caCert = tmpDir / "ca.crt";
caKey = tmpDir / "ca.key";
@@ -51,9 +50,11 @@ void HttpsBinaryCacheStoreTest::SetUp()
// clang-format off
openssl({"ecparam", "-genkey", "-name", "prime256v1", "-out", caKey.string()});
openssl({"req", "-new", "-x509", "-days", "1", "-key", caKey.string(), "-out", caCert.string(), "-subj", "/CN=TestCA"});
auto serverExtFile = tmpDir / "server.ext";
writeFile(serverExtFile, "subjectAltName=DNS:localhost,IP:127.0.0.1");
openssl({"ecparam", "-genkey", "-name", "prime256v1", "-out", serverKey.string()});
openssl({"req", "-new", "-key", serverKey.string(), "-out", (tmpDir / "server.csr").string(), "-subj", "/CN=localhost"});
openssl({"x509", "-req", "-in", (tmpDir / "server.csr").string(), "-CA", caCert.string(), "-CAkey", caKey.string(), "-CAcreateserial", "-out", serverCert.string(), "-days", "1"});
openssl({"req", "-new", "-key", serverKey.string(), "-out", (tmpDir / "server.csr").string(), "-subj", "/CN=localhost", "-addext", "subjectAltName=DNS:localhost,IP:127.0.0.1"});
openssl({"x509", "-req", "-in", (tmpDir / "server.csr").string(), "-CA", caCert.string(), "-CAkey", caKey.string(), "-CAcreateserial", "-out", serverCert.string(), "-days", "1", "-extfile", serverExtFile.string()});
openssl({"ecparam", "-genkey", "-name", "prime256v1", "-out", clientKey.string()});
openssl({"req", "-new", "-key", clientKey.string(), "-out", (tmpDir / "client.csr").string(), "-subj", "/CN=TestClient"});
openssl({"x509", "-req", "-in", (tmpDir / "client.csr").string(), "-CA", caCert.string(), "-CAkey", caKey.string(), "-CAcreateserial", "-out", clientCert.string(), "-days", "1"});
@@ -122,7 +123,6 @@ std::vector<std::string> HttpsBinaryCacheStoreMtlsTest::serverArgs()
ref<TestHttpBinaryCacheStoreConfig> HttpsBinaryCacheStoreTest::makeConfig()
{
auto res = make_ref<TestHttpBinaryCacheStoreConfig>(
settings,
ParsedURL{
.scheme = "https",
.authority =
@@ -12,8 +12,6 @@
#include "nix/util/file-system.hh"
#include "nix/util/processes.hh"
#include "nix/store/tests/test-main.hh"
namespace nix::testing {
class TestHttpBinaryCacheStoreConfig;
@@ -44,9 +42,9 @@ public:
class TestHttpBinaryCacheStoreConfig : public HttpBinaryCacheStoreConfig
{
public:
TestHttpBinaryCacheStoreConfig(nix::Settings & settings, ParsedURL url, const Store::Config::Params & params)
: StoreConfig(settings, params)
, HttpBinaryCacheStoreConfig(settings, url, params)
TestHttpBinaryCacheStoreConfig(ParsedURL url, const Store::Config::Params & params)
: StoreConfig(params)
, HttpBinaryCacheStoreConfig(url, params)
{
}
@@ -58,8 +56,6 @@ class HttpsBinaryCacheStoreTest : public virtual LibStoreNetworkTest
std::unique_ptr<AutoDelete> delTmpDir;
public:
Settings settings = getTestSettings();
static void SetUpTestSuite()
{
initLibStore(/*loadConfig=*/false);
@@ -7,7 +7,6 @@
#include "nix/store/store-api.hh"
#include "nix/store/store-open.hh"
#include "nix/store/globals.hh"
#include "nix/store/tests/test-main.hh"
namespace nix {
@@ -19,16 +18,14 @@ public:
initLibStore(false);
}
Settings settings = getTestSettings();
protected:
LibStoreTest(auto && makeStore)
: store(makeStore(settings))
LibStoreTest(ref<Store> store)
: store(std::move(store))
{
}
LibStoreTest()
: LibStoreTest([](auto & settings) { return openStore(settings, "dummy://"); })
: LibStoreTest(openStore("dummy://"))
{
}
@@ -51,7 +51,7 @@ protected:
// resolve any symlinks in i.e. on macOS /tmp -> /private/tmp
// because this is not allowed for a nix store.
auto tmpl =
nix::absPath(std::filesystem::path(nix::defaultTempDir()) / "tests_nix-store.XXXXXX", std::nullopt, true);
nix::absPath(std::filesystem::path(nix::defaultTempDir()) / "tests_nix-store.XXXXXX", nullptr, true);
nixDir = mkdtemp((char *) tmpl.c_str());
#endif
@@ -4,13 +4,6 @@
namespace nix {
class Settings;
/**
* Get a Settings object configured appropriately for unit testing.
*/
Settings getTestSettings();
/**
* Call this for a GTest test suite that will including performing Nix
* builds, before running tests.
+5 -12
View File
@@ -7,9 +7,12 @@
namespace nix {
Settings getTestSettings()
int testMainForBuidingPre(int argc, char ** argv)
{
Settings settings;
if (argc > 1 && std::string_view(argv[1]) == "__build-remote") {
printError("test-build-remote: not supported in libexpr unit tests");
return EXIT_FAILURE;
}
// Disable build hook. We won't be testing remote builds in these unit tests. If we do, fix the above build hook.
settings.getWorkerSettings().buildHook = {};
@@ -38,16 +41,6 @@ Settings getTestSettings()
setEnv("_NIX_TEST_NO_SANDBOX", "1");
#endif
return settings;
}
int testMainForBuidingPre(int argc, char ** argv)
{
if (argc > 1 && std::string_view(argv[1]) == "__build-remote") {
printError("test-build-remote: not supported in libexpr unit tests");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
@@ -193,7 +193,7 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_defaults)
EXPECT_EQ(options, advancedAttributes_defaults);
EXPECT_EQ(options.substitutesAllowed(this->settings.getWorkerSettings()), true);
EXPECT_EQ(options.substitutesAllowed(settings.getWorkerSettings()), true);
EXPECT_EQ(options.useUidRange(got), false);
});
};
@@ -241,7 +241,7 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes)
EXPECT_EQ(options, expected);
EXPECT_EQ(options.substitutesAllowed(this->settings.getWorkerSettings()), false);
EXPECT_EQ(options.substitutesAllowed(settings.getWorkerSettings()), false);
EXPECT_EQ(options.useUidRange(got), true);
});
};
@@ -333,7 +333,7 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs_d
EXPECT_EQ(options, advancedAttributes_structuredAttrs_defaults);
EXPECT_EQ(options.substitutesAllowed(this->settings.getWorkerSettings()), true);
EXPECT_EQ(options.substitutesAllowed(settings.getWorkerSettings()), true);
EXPECT_EQ(options.useUidRange(got), false);
});
};
@@ -398,7 +398,7 @@ TYPED_TEST(DerivationAdvancedAttrsBothTest, advancedAttributes_structuredAttrs)
EXPECT_EQ(options, expected);
EXPECT_EQ(options.substitutesAllowed(this->settings.getWorkerSettings()), false);
EXPECT_EQ(options.substitutesAllowed(settings.getWorkerSettings()), false);
EXPECT_EQ(options.useUidRange(got), true);
});
};
+3 -3
View File
@@ -16,11 +16,11 @@ class FillInOutputPathsTest : public LibStoreTest, public JsonCharacterizationTe
protected:
FillInOutputPathsTest()
: LibStoreTest([](auto & settings) {
auto config = make_ref<DummyStoreConfig>(settings, DummyStoreConfig::Params{});
: LibStoreTest([]() {
auto config = make_ref<DummyStoreConfig>(DummyStoreConfig::Params{});
config->readOnly = false;
return config->openDummyStore();
})
}())
{
}
+5 -10
View File
@@ -7,7 +7,6 @@
#include "nix/store/realisation.hh"
#include "nix/util/tests/json-characterization.hh"
#include "nix/store/tests/test-main.hh"
namespace nix {
@@ -32,10 +31,8 @@ TEST(DummyStore, realisation_read)
{
initLibStore(/*loadConfig=*/false);
auto settings = getTestSettings();
auto store = [&] {
auto cfg = make_ref<DummyStoreConfig>(settings, StoreReference::Params{});
auto store = [] {
auto cfg = make_ref<DummyStoreConfig>(StoreReference::Params{});
cfg->readOnly = false;
return cfg->openDummyStore();
}();
@@ -76,10 +73,9 @@ TEST_P(DummyStoreJsonTest, from_json)
using namespace nlohmann;
/* Cannot use `readJsonTest` because need to dereference the stores
for equality. */
auto settings = getTestSettings();
readTest(Path{name} + ".json", [&](const auto & encodedRaw) {
auto encoded = json::parse(encodedRaw);
ref<DummyStore> decoded = adl_serializer<ref<DummyStore>>::from_json(settings, encoded);
ref<DummyStore> decoded = adl_serializer<ref<DummyStore>>::from_json(encoded);
ASSERT_EQ(*decoded, *expected);
});
}
@@ -92,13 +88,12 @@ TEST_P(DummyStoreJsonTest, to_json)
INSTANTIATE_TEST_SUITE_P(DummyStoreJSON, DummyStoreJsonTest, [] {
initLibStore(false);
auto settings = getTestSettings();
auto writeCfg = make_ref<DummyStore::Config>(settings, DummyStore::Config::Params{});
auto writeCfg = make_ref<DummyStore::Config>(DummyStore::Config::Params{});
writeCfg->readOnly = false;
return ::testing::Values(
std::pair{
"empty",
make_ref<DummyStore::Config>(settings, DummyStore::Config::Params{})->openDummyStore(),
make_ref<DummyStore::Config>(DummyStore::Config::Params{})->openDummyStore(),
},
std::pair{
"one-flat-file",
+4 -10
View File
@@ -1,44 +1,38 @@
#include <gtest/gtest.h>
#include <regex>
#include "nix/store/globals.hh"
#include "nix/store/http-binary-cache-store.hh"
#include "nix/store/tests/https-store.hh"
#include "nix/util/fs-sink.hh"
#include "nix/store/tests/test-main.hh"
namespace nix {
TEST(HttpBinaryCacheStore, constructConfig)
{
auto settings = getTestSettings();
HttpBinaryCacheStoreConfig config{settings, "http", "foo.bar.baz", {}};
HttpBinaryCacheStoreConfig config{"http", "foo.bar.baz", {}};
EXPECT_EQ(config.cacheUri.to_string(), "http://foo.bar.baz");
}
TEST(HttpBinaryCacheStore, constructConfigNoTrailingSlash)
{
auto settings = getTestSettings();
HttpBinaryCacheStoreConfig config{settings, "https", "foo.bar.baz/a/b/", {}};
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b/", {}};
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b");
}
TEST(HttpBinaryCacheStore, constructConfigWithParams)
{
auto settings = getTestSettings();
StoreConfig::Params params{{"compression", "xz"}};
HttpBinaryCacheStoreConfig config{settings, "https", "foo.bar.baz/a/b/", params};
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b/", params};
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b");
EXPECT_EQ(config.getReference().params, params);
}
TEST(HttpBinaryCacheStore, constructConfigWithParamsAndUrlWithParams)
{
auto settings = getTestSettings();
StoreConfig::Params params{{"compression", "xz"}};
HttpBinaryCacheStoreConfig config{settings, "https", "foo.bar.baz/a/b?some-param=some-value", params};
HttpBinaryCacheStoreConfig config{"https", "foo.bar.baz/a/b?some-param=some-value", params};
EXPECT_EQ(config.cacheUri.to_string(), "https://foo.bar.baz/a/b?some-param=some-value");
EXPECT_EQ(config.getReference().params, params);
}
-4
View File
@@ -1,16 +1,12 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/legacy-ssh-store.hh"
#include "nix/store/tests/test-main.hh"
namespace nix {
TEST(LegacySSHStore, constructConfig)
{
auto settings = getTestSettings();
LegacySSHStoreConfig config(
settings,
"ssh",
"me@localhost:2222",
StoreConfig::Params{
@@ -1,14 +1,12 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/local-binary-cache-store.hh"
namespace nix {
TEST(LocalBinaryCacheStore, constructConfig)
{
Settings settings;
LocalBinaryCacheStoreConfig config{settings, "local", "/foo/bar/baz", {}};
LocalBinaryCacheStoreConfig config{"local", "/foo/bar/baz", {}};
EXPECT_EQ(config.binaryCacheDir, "/foo/bar/baz");
}
+1 -6
View File
@@ -1,16 +1,12 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/local-overlay-store.hh"
#include "nix/store/tests/test-main.hh"
namespace nix {
TEST(LocalOverlayStore, constructConfig_rootQueryParam)
{
auto settings = getTestSettings();
LocalOverlayStoreConfig config{
settings,
"local-overlay",
"",
{
@@ -26,8 +22,7 @@ TEST(LocalOverlayStore, constructConfig_rootQueryParam)
TEST(LocalOverlayStore, constructConfig_rootPath)
{
auto settings = getTestSettings();
LocalOverlayStoreConfig config{settings, "local-overlay", "/foo/bar", {}};
LocalOverlayStoreConfig config{"local-overlay", "/foo/bar", {}};
EXPECT_EQ(config.rootDir.get(), std::optional{"/foo/bar"});
}
+8 -8
View File
@@ -1,16 +1,18 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/local-store.hh"
#include "nix/store/tests/test-main.hh"
// Needed for template specialisations. This is not good! When we
// overhaul how store configs work, this should be fixed.
#include "nix/util/args.hh"
#include "nix/util/config-impl.hh"
#include "nix/util/abstract-setting-to-json.hh"
namespace nix {
TEST(LocalStore, constructConfig_rootQueryParam)
{
auto settings = getTestSettings();
LocalStoreConfig config{
settings,
"local",
"",
{
@@ -26,16 +28,14 @@ TEST(LocalStore, constructConfig_rootQueryParam)
TEST(LocalStore, constructConfig_rootPath)
{
auto settings = getTestSettings();
LocalStoreConfig config{settings, "local", "/foo/bar", {}};
LocalStoreConfig config{"local", "/foo/bar", {}};
EXPECT_EQ(config.rootDir.get(), std::optional{"/foo/bar"});
}
TEST(LocalStore, constructConfig_to_string)
{
auto settings = getTestSettings();
LocalStoreConfig config{settings, "local", "", {}};
LocalStoreConfig config{"local", "", {}};
EXPECT_EQ(config.getReference().to_string(), "local");
}
-4
View File
@@ -13,10 +13,6 @@ using testing::Eq;
using testing::Field;
using testing::SizeIs;
namespace nix::fs {
using namespace std::filesystem;
}
using namespace nix;
TEST(machines, getMachinesWithEmptyBuilders)
+2 -6
View File
@@ -1,13 +1,11 @@
#include "nix/store/nar-info-disk-cache.hh"
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/sqlite.hh"
#include <sqlite3.h>
#include "nix/store/globals.hh"
#include "nix/store/sqlite.hh"
#include "nix/store/nar-info-disk-cache.hh"
namespace nix {
TEST(NarInfoDiskCacheImpl, create_and_read)
@@ -26,8 +24,6 @@ TEST(NarInfoDiskCacheImpl, create_and_read)
SQLite db;
SQLiteStmt getIds;
Settings settings;
{
auto cache = NarInfoDiskCache::getTest(
settings.getNarInfoDiskCacheSettings(), {.useWAL = settings.useSQLiteWAL}, dbPath.string());
+12 -12
View File
@@ -299,7 +299,7 @@ public:
nix_api_store_test_base::SetUp();
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
store = open_local_store();
@@ -309,7 +309,7 @@ public:
buffer << t.rdbuf();
// Replace the hardcoded system with the current system
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", cStoreSettings.thisSystem.get());
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", nix::settings.thisSystem.get());
drv = nix_derivation_from_json(ctx, store, jsonStr.c_str());
assert_ctx_ok();
@@ -354,7 +354,7 @@ TEST_F(nix_api_store_test_base, build_from_json)
{
// FIXME get rid of these
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
auto * store = open_local_store();
@@ -365,7 +365,7 @@ TEST_F(nix_api_store_test_base, build_from_json)
buffer << t.rdbuf();
// Replace the hardcoded system with the current system
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", cStoreSettings.thisSystem.get());
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", nix::settings.thisSystem.get());
auto * drv = nix_derivation_from_json(ctx, store, jsonStr.c_str());
assert_ctx_ok();
@@ -401,7 +401,7 @@ TEST_F(nix_api_store_test_base, nix_store_realise_invalid_system)
{
// Test that nix_store_realise properly reports errors when the system is invalid
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
auto * store = open_local_store();
@@ -446,7 +446,7 @@ TEST_F(nix_api_store_test_base, nix_store_realise_builder_fails)
{
// Test that nix_store_realise properly reports errors when the builder fails
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
auto * store = open_local_store();
@@ -456,7 +456,7 @@ TEST_F(nix_api_store_test_base, nix_store_realise_builder_fails)
buffer << t.rdbuf();
// Replace with current system and make builder command fail
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", cStoreSettings.thisSystem.get());
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", nix::settings.thisSystem.get());
jsonStr = nix::replaceStrings(jsonStr, "echo $name foo > $out", "exit 1");
auto * drv = nix_derivation_from_json(ctx, store, jsonStr.c_str());
@@ -491,7 +491,7 @@ TEST_F(nix_api_store_test_base, nix_store_realise_builder_no_output)
{
// Test that nix_store_realise properly reports errors when builder succeeds but produces no output
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
auto * store = open_local_store();
@@ -501,7 +501,7 @@ TEST_F(nix_api_store_test_base, nix_store_realise_builder_no_output)
buffer << t.rdbuf();
// Replace with current system and make builder succeed but not produce output
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", cStoreSettings.thisSystem.get());
std::string jsonStr = nix::replaceStrings(buffer.str(), "x86_64-linux", nix::settings.thisSystem.get());
jsonStr = nix::replaceStrings(jsonStr, "echo $name foo > $out", "true");
auto * drv = nix_derivation_from_json(ctx, store, jsonStr.c_str());
@@ -687,7 +687,7 @@ TEST_F(NixApiStoreTestWithRealisedPath, nix_store_realise_output_ordering)
// This test uses a CA derivation with 10 outputs in randomized input order
// to verify that the callback order is deterministic and alphabetical.
nix::experimentalFeatureSettings.set("extra-experimental-features", "ca-derivations");
cStoreSettings.getWorkerSettings().substituters = {};
nix::settings.getWorkerSettings().substituters = {};
auto * store = open_local_store();
@@ -706,14 +706,14 @@ TEST_F(NixApiStoreTestWithRealisedPath, nix_store_realise_output_ordering)
std::string drvJson = R"({
"version": 4,
"name": "multi-output-test",
"system": ")" + cStoreSettings.thisSystem.get()
"system": ")" + nix::settings.thisSystem.get()
+ R"(",
"builder": "/bin/sh",
"args": ["-c", "echo a > $outa; echo b > $outb; echo c > $outc; echo d > $outd; echo e > $oute; echo f > $outf; echo g > $outg; echo h > $outh; echo i > $outi; echo j > $outj"],
"env": {
"builder": "/bin/sh",
"name": "multi-output-test",
"system": ")" + cStoreSettings.thisSystem.get()
"system": ")" + nix::settings.thisSystem.get()
+ R"(",
"outf": ")" + outf_ph
+ R"(",
+7 -19
View File
@@ -1,9 +1,7 @@
#include "nix/store/globals.hh"
#include "nix/store/s3-binary-cache-store.hh"
#include "nix/store/http-binary-cache-store.hh"
#include "nix/store/filetransfer.hh"
#include "nix/store/s3-url.hh"
#include "nix/store/tests/test-main.hh"
#include <gtest/gtest.h>
@@ -11,8 +9,7 @@ namespace nix {
TEST(S3BinaryCacheStore, constructConfig)
{
auto settings = getTestSettings();
S3BinaryCacheStoreConfig config{settings, "s3", "foobar", {}};
S3BinaryCacheStoreConfig config{"s3", "foobar", {}};
// The bucket name is stored as the host part of the authority in cacheUri
EXPECT_EQ(
@@ -25,9 +22,8 @@ TEST(S3BinaryCacheStore, constructConfig)
TEST(S3BinaryCacheStore, constructConfigWithRegion)
{
auto settings = getTestSettings();
Store::Config::Params params{{"region", "eu-west-1"}};
S3BinaryCacheStoreConfig config{settings, "s3", "my-bucket", params};
S3BinaryCacheStoreConfig config{"s3", "my-bucket", params};
EXPECT_EQ(
config.cacheUri,
@@ -41,8 +37,7 @@ TEST(S3BinaryCacheStore, constructConfigWithRegion)
TEST(S3BinaryCacheStore, defaultSettings)
{
auto settings = getTestSettings();
S3BinaryCacheStoreConfig config{settings, "s3", "test-bucket", {}};
S3BinaryCacheStoreConfig config{"s3", "test-bucket", {}};
EXPECT_EQ(
config.cacheUri,
@@ -63,13 +58,11 @@ TEST(S3BinaryCacheStore, defaultSettings)
*/
TEST(S3BinaryCacheStore, s3StoreConfigPreservesParameters)
{
auto settings = getTestSettings();
StringMap params;
params["region"] = "eu-west-1";
params["endpoint"] = "custom.s3.com";
S3BinaryCacheStoreConfig config(settings, "s3", "test-bucket", params);
S3BinaryCacheStoreConfig config("s3", "test-bucket", params);
// The config should preserve S3-specific parameters
EXPECT_EQ(
@@ -100,15 +93,13 @@ TEST(S3BinaryCacheStore, s3SchemeRegistration)
*/
TEST(S3BinaryCacheStore, parameterFiltering)
{
auto settings = getTestSettings();
StringMap params;
params["region"] = "eu-west-1";
params["endpoint"] = "minio.local";
params["want-mass-query"] = "true"; // Non-S3 store parameter
params["priority"] = "10"; // Non-S3 store parameter
S3BinaryCacheStoreConfig config(settings, "s3", "test-bucket", params);
S3BinaryCacheStoreConfig config("s3", "test-bucket", params);
// Only S3-specific params should be in cacheUri.query
EXPECT_EQ(
@@ -136,19 +127,16 @@ TEST(S3BinaryCacheStore, parameterFiltering)
*/
TEST(S3BinaryCacheStore, storageClassDefault)
{
auto settings = getTestSettings();
S3BinaryCacheStoreConfig config{settings, "s3", "test-bucket", {}};
S3BinaryCacheStoreConfig config{"s3", "test-bucket", {}};
EXPECT_EQ(config.storageClass.get(), std::nullopt);
}
TEST(S3BinaryCacheStore, storageClassConfiguration)
{
auto settings = getTestSettings();
StringMap params;
params["storage-class"] = "GLACIER";
S3BinaryCacheStoreConfig config(settings, "s3", "test-bucket", params);
S3BinaryCacheStoreConfig config("s3", "test-bucket", params);
EXPECT_EQ(config.storageClass.get(), std::optional<std::string>("GLACIER"));
}
+2 -6
View File
@@ -1,16 +1,14 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/ssh-store.hh"
#include "nix/store/tests/test-main.hh"
#include "nix/util/config-impl.hh"
#include "nix/util/abstract-setting-to-json.hh"
namespace nix {
TEST(SSHStore, constructConfig)
{
auto settings = getTestSettings();
SSHStoreConfig config{
settings,
"ssh-ng",
"me@localhost:2222",
StoreConfig::Params{
@@ -36,9 +34,7 @@ TEST(SSHStore, constructConfig)
TEST(MountedSSHStore, constructConfig)
{
auto settings = getTestSettings();
MountedSSHStoreConfig config{
settings,
"mounted-ssh",
"localhost",
StoreConfig::Params{
+5 -15
View File
@@ -1,38 +1,31 @@
#include <gtest/gtest.h>
#include "nix/store/globals.hh"
#include "nix/store/uds-remote-store.hh"
namespace nix {
TEST(UDSRemoteStore, constructConfig)
{
Settings settings;
UDSRemoteStoreConfig config{settings, "unix", "/tmp/socket", {}};
UDSRemoteStoreConfig config{"unix", "/tmp/socket", {}};
EXPECT_EQ(config.path, "/tmp/socket");
}
TEST(UDSRemoteStore, constructConfigWrongScheme)
{
Settings settings;
EXPECT_THROW(UDSRemoteStoreConfig(settings, "http", "/tmp/socket", {}), UsageError);
EXPECT_THROW(UDSRemoteStoreConfig("http", "/tmp/socket", {}), UsageError);
}
TEST(UDSRemoteStore, constructConfig_to_string)
{
Settings settings;
UDSRemoteStoreConfig config{settings, "unix", "", {}};
UDSRemoteStoreConfig config{"unix", "", {}};
EXPECT_EQ(config.getReference().to_string(), "daemon");
}
TEST(UDSRemoteStore, constructConfigWithParams)
{
Settings settings;
StoreConfig::Params params{{"max-connections", "1"}};
UDSRemoteStoreConfig config{settings, "unix", "/tmp/socket", params};
UDSRemoteStoreConfig config{"unix", "/tmp/socket", params};
auto storeReference = config.getReference();
EXPECT_EQ(storeReference.to_string(), "unix:///tmp/socket?max-connections=1");
EXPECT_EQ(storeReference.render(/*withParams=*/false), "unix:///tmp/socket");
@@ -41,11 +34,8 @@ TEST(UDSRemoteStore, constructConfigWithParams)
TEST(UDSRemoteStore, constructConfigWithParamsNoPath)
{
Settings settings;
StoreConfig::Params params{{"max-connections", "1"}};
UDSRemoteStoreConfig config{settings, "unix", "", params};
UDSRemoteStoreConfig config{"unix", "", params};
auto storeReference = config.getReference();
EXPECT_EQ(storeReference.to_string(), "daemon?max-connections=1");
EXPECT_EQ(storeReference.render(/*withParams=*/false), "daemon");
+17 -17
View File
@@ -21,14 +21,14 @@ protected:
ref<DummyStore> substituter;
WorkerSubstitutionTest()
: LibStoreTest([](auto & settings) {
auto config = make_ref<DummyStoreConfig>(settings, DummyStoreConfig::Params{});
: LibStoreTest([] {
auto config = make_ref<DummyStoreConfig>(DummyStoreConfig::Params{});
config->readOnly = false;
return config->openDummyStore();
})
}())
, dummyStore(store.dynamic_pointer_cast<DummyStore>())
, substituter([this] {
auto config = make_ref<DummyStoreConfig>(settings, DummyStoreConfig::Params{});
, substituter([] {
auto config = make_ref<DummyStoreConfig>(DummyStoreConfig::Params{});
config->readOnly = false;
config->isTrusted = true;
return config->openDummyStore();
@@ -67,10 +67,10 @@ TEST_F(WorkerSubstitutionTest, singleStoreObject)
HashAlgorithm::SHA256);
// Snapshot the substituter (has one store object)
checkpointJson("single/substituter", substituter, settings);
checkpointJson("single/substituter", substituter);
// Snapshot the destination store before (should be empty)
checkpointJson("../dummy-store/empty", dummyStore, settings);
checkpointJson("../dummy-store/empty", dummyStore);
// The path should not exist in the destination store yet
ASSERT_FALSE(dummyStore->isValidPath(pathInSubstituter));
@@ -92,7 +92,7 @@ TEST_F(WorkerSubstitutionTest, singleStoreObject)
worker.run(goals);
// Snapshot the destination store after (should match the substituter)
checkpointJson("single/substituter", dummyStore, settings);
checkpointJson("single/substituter", dummyStore);
// The path should now exist in the destination store
ASSERT_TRUE(dummyStore->isValidPath(pathInSubstituter));
@@ -138,10 +138,10 @@ TEST_F(WorkerSubstitutionTest, singleRootStoreObjectWithSingleDepStoreObject)
StorePathSet{dependencyPath});
// Snapshot the substituter (has two store objects)
checkpointJson("with-dep/substituter", substituter, settings);
checkpointJson("with-dep/substituter", substituter);
// Snapshot the destination store before (should be empty)
checkpointJson("../dummy-store/empty", dummyStore, settings);
checkpointJson("../dummy-store/empty", dummyStore);
// Neither path should exist in the destination store yet
ASSERT_FALSE(dummyStore->isValidPath(dependencyPath));
@@ -164,7 +164,7 @@ TEST_F(WorkerSubstitutionTest, singleRootStoreObjectWithSingleDepStoreObject)
worker.run(goals);
// Snapshot the destination store after (should match the substituter)
checkpointJson("with-dep/substituter", dummyStore, settings);
checkpointJson("with-dep/substituter", dummyStore);
// Both paths should now exist in the destination store
ASSERT_TRUE(dummyStore->isValidPath(dependencyPath));
@@ -196,7 +196,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutput)
auto drvPath = dummyStore->writeDerivation(drv);
// Snapshot the destination store before
checkpointJson("ca-drv/store-before", dummyStore, settings);
checkpointJson("ca-drv/store-before", dummyStore);
// Compute the hash modulo of the derivation
// For CA floating derivations, the kind is Deferred since outputs aren't known until build
@@ -233,7 +233,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutput)
});
// Snapshot the substituter
checkpointJson("ca-drv/substituter", substituter, settings);
checkpointJson("ca-drv/substituter", substituter);
// The realisation should not exist in the destination store yet
DrvOutput drvOutput{drvHash, "out"};
@@ -256,7 +256,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutput)
worker.run(goals);
// Snapshot the destination store after
checkpointJson("ca-drv/store-after", dummyStore, settings);
checkpointJson("ca-drv/store-after", dummyStore);
// The output path should now exist in the destination store
ASSERT_TRUE(dummyStore->isValidPath(outputPath));
@@ -351,7 +351,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutputWithDepDrv)
auto rootDrvPath = dummyStore->writeDerivation(rootDrv);
// Snapshot the destination store before
checkpointJson("issue-11928/store-before", dummyStore, settings);
checkpointJson("issue-11928/store-before", dummyStore);
// Compute the hash modulo for the root derivation
auto rootHashModulo = hashDerivationModulo(*dummyStore, rootDrv, true);
@@ -395,7 +395,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutputWithDepDrv)
// Snapshot the substituter
// Note: it has realisations for both drvs, but only the root's output store object
checkpointJson("issue-11928/substituter", substituter, settings);
checkpointJson("issue-11928/substituter", substituter);
// The realisations should not exist in the destination store yet
ASSERT_FALSE(dummyStore->queryRealisation(depDrvOutput));
@@ -418,7 +418,7 @@ TEST_F(WorkerSubstitutionTest, floatingDerivationOutputWithDepDrv)
worker.run(goals);
// Snapshot the destination store after
checkpointJson("issue-11928/store-after", dummyStore, settings);
checkpointJson("issue-11928/store-after", dummyStore);
// The root output path should now exist in the destination store
ASSERT_TRUE(dummyStore->isValidPath(rootOutputPath));
+5 -8
View File
@@ -12,22 +12,19 @@ namespace {
class WriteDerivationTest : public LibStoreTest
{
protected:
WriteDerivationTest(auto && makeConfig)
: LibStoreTest([&](auto & settings) {
this->config = makeConfig(settings);
return config->openDummyStore();
})
WriteDerivationTest(ref<DummyStoreConfig> config_)
: LibStoreTest(config_->openDummyStore())
, config(std::move(config_))
{
config->readOnly = false;
}
WriteDerivationTest()
: WriteDerivationTest(
[](auto & settings) { return make_ref<DummyStoreConfig>(settings, DummyStoreConfig::Params{}); })
: WriteDerivationTest(make_ref<DummyStoreConfig>(DummyStoreConfig::Params{}))
{
}
std::shared_ptr<DummyStoreConfig> config;
ref<DummyStoreConfig> config;
};
static Derivation makeSimpleDrv()
+1 -1
View File
@@ -28,7 +28,7 @@ BinaryCacheStore::BinaryCacheStore(Config & config)
: config{config}
{
if (config.secretKeyFile != "")
signers.push_back(std::make_unique<LocalSigner>(SecretKey{readFile(config.secretKeyFile)}));
signers.push_back(std::make_unique<LocalSigner>(SecretKey{readFile(config.secretKeyFile.get())}));
if (config.secretKeyFiles != "") {
std::stringstream ss(config.secretKeyFiles);
+13 -15
View File
@@ -327,8 +327,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild(StorePathSet inputPaths)
}
bool canBuildLocally = [&] {
if (drv->platform != worker.store.config.settings.thisSystem.get()
&& !worker.store.config.settings.extraPlatforms.get().count(drv->platform) && !drv->isBuiltin())
if (drv->platform != settings.thisSystem.get() && !settings.extraPlatforms.get().count(drv->platform)
&& !drv->isBuiltin())
return false;
if (worker.settings.maxBuildJobs.get() == 0 && !drv->isBuiltin())
@@ -377,7 +377,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild(StorePathSet inputPaths)
use that. If there is not, then check if we can do a "true" local
build. */
externalBuilder = worker.store.config.settings.findExternalDerivationBuilderIfSupported(*drv);
externalBuilder = settings.findExternalDerivationBuilderIfSupported(*drv);
if (!externalBuilder && !canBuildLocally) {
auto msg =
@@ -389,12 +389,12 @@ Goal::Co DerivationBuildingGoal::tryToBuild(StorePathSet inputPaths)
Magenta(worker.store.printStorePath(drvPath)),
Magenta(drv->platform),
concatStringsSep(", ", drvOptions.getRequiredSystemFeatures(*drv)),
Magenta(worker.store.config.settings.thisSystem),
Magenta(settings.thisSystem),
concatStringsSep<StringSet>(", ", worker.store.Store::config.systemFeatures));
// since aarch64-darwin has Rosetta 2, this user can actually run x86_64-darwin on their hardware -
// we should tell them to run the command to install Darwin 2
if (drv->platform == "x86_64-darwin" && worker.store.config.settings.thisSystem == "aarch64-darwin")
if (drv->platform == "x86_64-darwin" && settings.thisSystem == "aarch64-darwin")
msg += fmt(
"\nNote: run `%s` to run programs for x86_64-darwin",
Magenta(
@@ -479,8 +479,7 @@ Goal::Co DerivationBuildingGoal::buildWithHook(
hook->toHook.writeSide.close();
/* Create the log file and pipe. */
std::unique_ptr<LogFile> logFile =
std::make_unique<LogFile>(worker.store, drvPath, worker.store.config.settings.getLogFileSettings());
std::unique_ptr<LogFile> logFile = std::make_unique<LogFile>(worker.store, drvPath, settings.getLogFileSettings());
std::set<MuxablePipePollState::CommChannel> fds;
fds.insert(hook->fromHook.readSide.get());
@@ -656,7 +655,7 @@ Goal::Co DerivationBuildingGoal::buildLocally(
std::unique_ptr<LogFile> logFile;
auto openLogFile = [&]() {
logFile = std::make_unique<LogFile>(worker.store, drvPath, worker.store.config.settings.getLogFileSettings());
logFile = std::make_unique<LogFile>(worker.store, drvPath, settings.getLogFileSettings());
};
auto closeLogFile = [&]() { logFile.reset(); };
@@ -757,7 +756,6 @@ Goal::Co DerivationBuildingGoal::buildLocally(
}
DerivationBuilderParams params{
.settings = worker.store.config.settings,
.drvPath = drvPath,
.buildResult = buildResult,
.drv = *drv,
@@ -1054,15 +1052,15 @@ LogFile::LogFile(Store & store, const StorePath & drvPath, const LogFileSettings
auto baseName = std::string(baseNameOf(store.printStorePath(drvPath)));
Path logDir;
std::filesystem::path logDir;
if (auto localStore = dynamic_cast<LocalStore *>(&store))
logDir = localStore->config->logDir;
logDir = localStore->config->logDir.get();
else
logDir = logSettings.nixLogDir.string();
Path dir = fmt("%s/%s/%s/", logDir, LocalFSStore::drvsLogDir, baseName.substr(0, 2));
logDir = logSettings.nixLogDir;
auto dir = logDir / LocalFSStore::drvsLogDir / baseName.substr(0, 2);
createDirs(dir);
Path logFileName = fmt("%s/%s%s", dir, baseName.substr(2), logSettings.compressLog ? ".bz2" : "");
auto logFileName = dir / (baseName.substr(2) + (logSettings.compressLog ? ".bz2" : ""));
fd = openNewFileForWrite(
logFileName,
@@ -1072,7 +1070,7 @@ LogFile::LogFile(Store & store, const StorePath & drvPath, const LogFileSettings
.followSymlinksOnTruncate = true, /* FIXME: Probably shouldn't follow symlinks. */
});
if (!fd)
throw SysError("creating log file '%1%'", logFileName);
throw SysError("creating log file %1%", PathFmt(logFileName));
fileSink = std::make_shared<FdSink>(fd.get());
+1 -1
View File
@@ -14,7 +14,7 @@ void checkOutputs(
const decltype(DerivationOptions<StorePath>::outputChecks) & outputChecks,
const std::map<std::string, ValidPathInfo> & outputs)
{
std::map<Path, const ValidPathInfo &> outputsByPath;
std::map<std::filesystem::path, const ValidPathInfo &> outputsByPath;
for (auto & output : outputs)
outputsByPath.emplace(store.printStorePath(output.second.path), output.second);
+4 -6
View File
@@ -22,9 +22,9 @@ Worker::Worker(Store & store, Store & evalStore)
, actSubstitutions(*logger, actCopyPaths)
, store(store)
, evalStore(evalStore)
, settings(store.config.settings.getWorkerSettings())
, getSubstituters{[&] {
return settings.useSubstitutes ? getDefaultSubstituters(store.config.settings) : std::list<ref<Store>>{};
, settings(nix::settings.getWorkerSettings())
, getSubstituters{[] {
return nix::settings.getWorkerSettings().useSubstitutes ? getDefaultSubstituters() : std::list<ref<Store>>{};
}}
{
nrLocalBuilds = 0;
@@ -367,9 +367,7 @@ void Worker::run(const Goals & _topGoals)
if (!children.empty() || !waitingForAWhile.empty())
waitForInput();
else if (awake.empty() && 0U == settings.maxBuildJobs) {
if (Machine::parseConfig(
{store.config.settings.thisSystem}, store.config.settings.getWorkerSettings().builders)
.empty())
if (Machine::parseConfig({nix::settings.thisSystem}, nix::settings.getWorkerSettings().builders).empty())
throw Error(
"Unable to start any build; either increase '--max-jobs' or enable remote builds.\n"
"\n"
+8 -8
View File
@@ -20,14 +20,14 @@ namespace {
struct State
{
std::map<Path, int> priorities;
std::map<std::filesystem::path, int> priorities;
unsigned long symlinks = 0;
};
} // namespace
/* For each activated package, create symlinks */
static void createLinks(State & state, const Path & srcDir, const Path & dstDir, int priority)
static void createLinks(State & state, const std::filesystem::path & srcDir, const std::filesystem::path & dstDir, int priority)
{
DirectoryIterator srcFiles;
@@ -35,7 +35,7 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
srcFiles = DirectoryIterator{srcDir};
} catch (SystemError & e) {
if (e.is(std::errc::not_a_directory)) {
warn("not including '%s' in the user environment because it's not a directory", srcDir);
warn("not including %s in the user environment because it's not a directory", PathFmt(srcDir));
return;
}
throw;
@@ -78,9 +78,9 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
} else if (S_ISLNK(dstSt.st_mode)) {
auto target = canonPath(dstFile, true);
if (!S_ISDIR(lstat(target).st_mode))
throw Error("collision between '%1%' and non-directory '%2%'", srcFile, target);
throw Error("collision between %1% and non-directory %2%", PathFmt(srcFile), PathFmt(target));
if (unlink(dstFile.c_str()) == -1)
throw SysError("unlinking '%1%'", dstFile);
throw SysError("unlinking %1%", PathFmt(dstFile));
if (mkdir(
dstFile.c_str()
#ifndef _WIN32 // TODO abstract mkdir perms for Windows
@@ -108,7 +108,7 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
if (prevPriority < priority)
continue;
if (unlink(dstFile.c_str()) == -1)
throw SysError("unlinking '%1%'", dstFile);
throw SysError("unlinking %1%", PathFmt(dstFile));
} else if (S_ISDIR(dstSt.st_mode))
throw Error("collision between non-directory '%1%' and directory '%2%'", srcFile, dstFile);
}
@@ -120,13 +120,13 @@ static void createLinks(State & state, const Path & srcDir, const Path & dstDir,
}
}
void buildProfile(const Path & out, Packages && pkgs)
void buildProfile(const std::filesystem::path & out, Packages && pkgs)
{
State state;
PathSet done, postponed;
auto addPkg = [&](const Path & pkgDir, int priority) {
auto addPkg = [&](const std::filesystem::path & pkgDir, int priority) {
if (!done.insert(pkgDir).second)
return;
createLinks(state, pkgDir, out, priority);
+4 -5
View File
@@ -5,15 +5,14 @@
namespace nix {
CommonSSHStoreConfig::CommonSSHStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view authority, const Params & params)
: CommonSSHStoreConfig(settings, scheme, ParsedURL::Authority::parse(authority), params)
CommonSSHStoreConfig::CommonSSHStoreConfig(std::string_view scheme, std::string_view authority, const Params & params)
: CommonSSHStoreConfig(scheme, ParsedURL::Authority::parse(authority), params)
{
}
CommonSSHStoreConfig::CommonSSHStoreConfig(
nix::Settings & settings, std::string_view scheme, const ParsedURL::Authority & authority, const Params & params)
: StoreConfig(settings, params)
std::string_view scheme, const ParsedURL::Authority & authority, const Params & params)
: StoreConfig(params)
, authority(authority)
{
}
+7 -7
View File
@@ -230,7 +230,7 @@ struct ClientSettings
bool useSubstitutes;
StringMap overrides;
void apply(Settings & settings, TrustedFlag trusted)
void apply(TrustedFlag trusted)
{
settings.keepFailed = keepFailed;
settings.getWorkerSettings().keepGoing = keepGoing;
@@ -680,21 +680,21 @@ static void performOp(
"you are not privileged to create perm roots\n\n"
"hint: you can just do this client-side without special privileges, and probably want to do that instead.");
auto storePath = WorkerProto::Serialise<StorePath>::read(*store, rconn);
Path gcRoot = absPath(readString(conn.from));
std::filesystem::path gcRoot = absPath(readString(conn.from));
logger->startWork();
auto & localFSStore = require<LocalFSStore>(*store);
localFSStore.addPermRoot(storePath, gcRoot);
localFSStore.addPermRoot(storePath, gcRoot.string());
logger->stopWork();
conn.to << gcRoot;
conn.to << gcRoot.string();
break;
}
case WorkerProto::Op::AddIndirectRoot: {
Path path = absPath(readString(conn.from));
std::filesystem::path path = absPath(readString(conn.from));
logger->startWork();
auto & indirectRootStore = require<IndirectRootStore>(*store);
indirectRootStore.addIndirectRoot(path);
indirectRootStore.addIndirectRoot(path.string());
logger->stopWork();
conn.to << 1;
@@ -783,7 +783,7 @@ static void performOp(
// FIXME: use some setting in recursive mode. Will need to use
// non-global variables.
if (!recursive)
clientSettings.apply(store->config.settings, trusted);
clientSettings.apply(trusted);
logger->stopWork();
break;
+4 -5
View File
@@ -408,10 +408,10 @@ void adl_serializer<DummyStore::PathInfoAndContents>::to_json(json & json, const
};
}
ref<DummyStoreConfig> adl_serializer<ref<DummyStore::Config>>::from_json(Settings & settings, const json & json)
ref<DummyStoreConfig> adl_serializer<ref<DummyStore::Config>>::from_json(const json & json)
{
auto & obj = getObject(json);
auto cfg = make_ref<DummyStore::Config>(settings, DummyStore::Config::Params{});
auto cfg = make_ref<DummyStore::Config>(DummyStore::Config::Params{});
const_cast<PathSetting &>(cfg->storeDir_).set(getString(valueAt(obj, "store")));
cfg->readOnly = true;
return cfg;
@@ -424,11 +424,10 @@ void adl_serializer<DummyStoreConfig>::to_json(json & json, const DummyStoreConf
};
}
ref<DummyStore> adl_serializer<ref<DummyStore>>::from_json(Settings & settings, const json & json)
ref<DummyStore> adl_serializer<ref<DummyStore>>::from_json(const json & json)
{
auto & obj = getObject(json);
ref<DummyStore> res =
adl_serializer<ref<DummyStoreConfig>>::from_json(settings, valueAt(obj, "config"))->openDummyStore();
ref<DummyStore> res = adl_serializer<ref<DummyStoreConfig>>::from_json(valueAt(obj, "config"))->openDummyStore();
for (auto & [k, v] : getObject(valueAt(obj, "contents")))
res->contents.insert({StorePath{k}, v});
for (auto & [k, v] : getObject(valueAt(obj, "derivations")))
+1 -1
View File
@@ -737,7 +737,7 @@ struct curlFileTransfer : public FileTransfer
download after a while. If we're writing to a
sink, we can only retry if the server supports
ranged requests. */
if (err == Transient && attempt < request.tries
if (err == Transient && attempt < fileTransfer.settings.tries
&& (!this->request.dataCallback || writtenToSink == 0 || (acceptRanges && encoding.empty()))) {
int ms = retryTimeMs
* std::pow(
+37 -36
View File
@@ -40,8 +40,8 @@ static std::string gcRootsDir = "gcroots";
void LocalStore::addIndirectRoot(const Path & path)
{
std::string hash = hashString(HashAlgorithm::SHA1, path).to_string(HashFormat::Nix32, false);
Path realRoot = canonPath(fmt("%1%/%2%/auto/%3%", config->stateDir, gcRootsDir, hash));
makeSymlink(realRoot, path);
auto realRoot = canonPath(config->stateDir.get() / gcRootsDir / "auto" / hash);
makeSymlink(realRoot.string(), path);
}
void LocalStore::createTempRootsFile()
@@ -60,7 +60,7 @@ void LocalStore::createTempRootsFile()
*fdTempRoots = openLockFile(fnTempRoots, true);
debug("acquiring write lock on '%s'", fnTempRoots);
debug("acquiring write lock on %s", PathFmt(fnTempRoots));
lockFile(fdTempRoots->get(), ltWrite, true);
/* Check whether the garbage collector didn't get in our
@@ -165,11 +165,11 @@ void LocalStore::findTempRoots(Roots & tempRoots, bool censor)
// those to keep the directory alive.
continue;
}
Path path = i.path().string();
auto path = i.path();
pid_t pid = std::stoi(name);
debug("reading temporary root file '%1%'", path);
debug("reading temporary root file %1%", PathFmt(path));
AutoCloseFD fd(toDescriptor(open(
path.c_str(),
#ifndef _WIN32
@@ -181,14 +181,14 @@ void LocalStore::findTempRoots(Roots & tempRoots, bool censor)
/* It's okay if the file has disappeared. */
if (errno == ENOENT)
continue;
throw SysError("opening temporary roots file '%1%'", path);
throw SysError("opening temporary roots file %1%", PathFmt(path));
}
/* Try to acquire a write lock without blocking. This can
only succeed if the owning process has died. In that case
we don't care about its temporary roots. */
if (lockFile(fd.get(), ltWrite, false)) {
printInfo("removing stale temporary roots file '%1%'", path);
printInfo("removing stale temporary roots file %1%", PathFmt(path));
unlink(path.c_str());
writeFull(fd.get(), "d");
continue;
@@ -201,7 +201,7 @@ void LocalStore::findTempRoots(Roots & tempRoots, bool censor)
std::string::size_type pos = 0, end;
while ((end = contents.find((char) 0, pos)) != std::string::npos) {
Path root(contents, pos, end - pos);
std::string root(contents, pos, end - pos);
debug("got temporary root '%s'", root);
tempRoots[parseStorePath(root)].emplace(censor ? censored : fmt("{temp:%d}", pid));
pos = end + 1;
@@ -211,13 +211,13 @@ void LocalStore::findTempRoots(Roots & tempRoots, bool censor)
void LocalStore::findRoots(const Path & path, std::filesystem::file_type type, Roots & roots)
{
auto foundRoot = [&](const Path & path, const Path & target) {
auto foundRoot = [&](const std::filesystem::path & path, const std::filesystem::path & target) {
try {
auto storePath = toStorePath(target).first;
auto storePath = toStorePath(target.string()).first;
if (isValidPath(storePath))
roots[std::move(storePath)].emplace(path);
roots[std::move(storePath)].emplace(path.string());
else
printInfo("skipping invalid root from '%1%' to '%2%'", path, target);
printInfo("skipping invalid root from %1% to %2%", PathFmt(path), PathFmt(target));
} catch (BadStorePath &) {
}
};
@@ -235,23 +235,24 @@ void LocalStore::findRoots(const Path & path, std::filesystem::file_type type, R
}
else if (type == std::filesystem::file_type::symlink) {
Path target = readLink(path);
if (isInStore(target))
auto target = readLink(path);
if (isInStore(target.string()))
foundRoot(path, target);
/* Handle indirect roots. */
else {
target = absPath(target, dirOf(path));
if (!pathExists(target)) {
auto parentPath = std::filesystem::path(path).parent_path();
target = absPath(target, &parentPath);
if (!pathExists(target.string())) {
if (isInDir(path, std::filesystem::path{config->stateDir.get()} / gcRootsDir / "auto")) {
printInfo("removing stale link from '%1%' to '%2%'", path, target);
printInfo("removing stale link from %1% to %2%", PathFmt(path), PathFmt(target));
unlink(path.c_str());
}
} else {
if (!std::filesystem::is_symlink(target))
return;
Path target2 = readLink(target);
if (isInStore(target2))
auto target2 = readLink(target);
if (isInStore(target2.string()))
foundRoot(target, target2);
}
}
@@ -287,8 +288,8 @@ void LocalStore::findRoots(const Path & path, std::filesystem::file_type type, R
void LocalStore::findRootsNoTemp(Roots & roots, bool censor)
{
/* Process direct roots in {gcroots,profiles}. */
findRoots(config->stateDir + "/" + gcRootsDir, std::filesystem::file_type::unknown, roots);
findRoots(config->stateDir + "/profiles", std::filesystem::file_type::unknown, roots);
findRoots((config->stateDir.get() / gcRootsDir).string(), std::filesystem::file_type::unknown, roots);
findRoots((config->stateDir.get() / "profiles").string(), std::filesystem::file_type::unknown, roots);
/* Add additional roots returned by different platforms-specific
heuristics. This is typically used to add running programs to
@@ -374,7 +375,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
/* Start the server for receiving new roots. */
auto socketPath = config->stateDir.get() + gcSocketPath;
createDirs(dirOf(socketPath));
createDirs(std::filesystem::path(socketPath).parent_path());
auto fdServer = createUnixDomainSocket(socketPath, 0666);
// TODO nonblocking socket on windows?
@@ -513,26 +514,26 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
/* Helper function that deletes a path from the store and throws
GCLimitReached if we've deleted enough garbage. */
auto deleteFromStore = [&](std::string_view baseName, bool isKnownPath) {
Path path = storeDir + "/" + std::string(baseName);
Path realPath = config->realStoreDir + "/" + std::string(baseName);
auto path = std::filesystem::path{storeDir} / std::string(baseName);
auto realPath = config->realStoreDir.get() / std::string(baseName);
/* There may be temp directories in the store that are still in use
by another process. We need to be sure that we can acquire an
exclusive lock before deleting them. */
if (baseName.find("tmp-", 0) == 0) {
AutoCloseFD tmpDirFd = openDirectory(realPath);
AutoCloseFD tmpDirFd = openDirectory(realPath.string());
if (!tmpDirFd || !lockFile(tmpDirFd.get(), ltWrite, false)) {
debug("skipping locked tempdir '%s'", realPath);
debug("skipping locked tempdir %s", PathFmt(realPath));
return;
}
}
printInfo("deleting '%1%'", path);
printInfo("deleting %1%", PathFmt(path));
results.paths.insert(path);
results.paths.insert(path.string());
uint64_t bytesFreed;
deleteStorePath(realPath, bytesFreed, isKnownPath);
deleteStorePath(realPath.string(), bytesFreed, isKnownPath);
results.bytesFreed += bytesFreed;
@@ -689,12 +690,12 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
try {
AutoCloseDir dir(opendir(config->realStoreDir.get().c_str()));
if (!dir)
throw SysError("opening directory '%1%'", config->realStoreDir);
throw SysError("opening directory %1%", PathFmt(config->realStoreDir.get()));
/* Read the store and delete all paths that are invalid or
unreachable. We don't use readDirectory() here so that
GCing can start faster. */
auto linksName = baseNameOf(linksDir);
auto linksName = linksDir.filename().string();
struct dirent * dirent;
while (errno = 0, dirent = readdir(dir.get())) {
checkInterrupt();
@@ -733,7 +734,7 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
AutoCloseDir dir(opendir(linksDir.c_str()));
if (!dir)
throw SysError("opening directory '%1%'", linksDir);
throw SysError("opening directory %1%", PathFmt(linksDir));
int64_t actualSize = 0, unsharedSize = 0;
@@ -743,9 +744,9 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
std::string name = dirent->d_name;
if (name == "." || name == "..")
continue;
Path path = linksDir + "/" + name;
auto path = linksDir / name;
auto st = lstat(path);
auto st = lstat(path.string());
if (st.st_nlink != 1) {
actualSize += st.st_size;
@@ -753,10 +754,10 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
continue;
}
printMsg(lvlTalkative, "deleting unused link '%1%'", path);
printMsg(lvlTalkative, "deleting unused link %1%", PathFmt(path));
if (unlink(path.c_str()) == -1)
throw SysError("deleting '%1%'", path);
throw SysError("deleting %1%", PathFmt(path));
/* Do not account for deleted file here. Rely on deletePath()
accounting. */
+4
View File
@@ -79,6 +79,10 @@ LogFileSettings::LogFileSettings()
{
}
Settings settings;
static GlobalConfig::Register rSettings(&settings);
Settings::Settings()
: nixStateDir(canonPath(getEnvNonEmpty("NIX_STATE_DIR").value_or(NIX_STATE_DIR)))
, nixDaemonSocketFile(canonPath(getEnvOsNonEmpty(OS_STR("NIX_DAEMON_SOCKET_PATH"))
+7 -9
View File
@@ -5,6 +5,7 @@
#include "nix/store/sqlite.hh"
#include "nix/util/callback.hh"
#include "nix/store/store-registration.hh"
#include "nix/store/globals.hh"
namespace nix {
@@ -20,9 +21,8 @@ StringSet HttpBinaryCacheStoreConfig::uriSchemes()
}
HttpBinaryCacheStoreConfig::HttpBinaryCacheStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view _cacheUri, const Params & params)
std::string_view scheme, std::string_view _cacheUri, const Params & params)
: HttpBinaryCacheStoreConfig(
settings,
parseURL(
std::string{scheme} + "://"
+ (!_cacheUri.empty()
@@ -32,10 +32,9 @@ HttpBinaryCacheStoreConfig::HttpBinaryCacheStoreConfig(
{
}
HttpBinaryCacheStoreConfig::HttpBinaryCacheStoreConfig(
nix::Settings & settings, ParsedURL _cacheUri, const Params & params)
: StoreConfig(settings, params)
, BinaryCacheStoreConfig(settings, params)
HttpBinaryCacheStoreConfig::HttpBinaryCacheStoreConfig(ParsedURL _cacheUri, const Params & params)
: StoreConfig(params)
, BinaryCacheStoreConfig(params)
, cacheUri(std::move(_cacheUri))
{
while (!cacheUri.path.empty() && cacheUri.path.back() == "")
@@ -67,8 +66,7 @@ HttpBinaryCacheStore::HttpBinaryCacheStore(ref<Config> config, ref<FileTransfer>
, fileTransfer{fileTransfer}
, config{config}
{
diskCache = NarInfoDiskCache::get(
config->settings.getNarInfoDiskCacheSettings(), {.useWAL = config->settings.useSQLiteWAL});
diskCache = NarInfoDiskCache::get(settings.getNarInfoDiskCacheSettings(), {.useWAL = settings.useSQLiteWAL});
}
void HttpBinaryCacheStore::init()
@@ -106,7 +104,7 @@ std::optional<CompressionAlgo> HttpBinaryCacheStore::getCompressionMethod(const
void HttpBinaryCacheStore::maybeDisable()
{
auto state(_state.lock());
if (state->enabled && config->settings.getWorkerSettings().tryFallback) {
if (state->enabled && settings.getWorkerSettings().tryFallback) {
int t = 60;
printError("disabling binary cache '%s' for %s seconds", config->getHumanReadableURI(), t);
state->enabled = false;
@@ -16,8 +16,6 @@
namespace nix {
class Settings;
/**
* Denotes a build failure that stemmed from the builder exiting with a
* failing exist status.
@@ -57,8 +55,6 @@ typedef std::map<std::filesystem::path, ChrootPath> PathsInChroot; // maps targe
*/
struct DerivationBuilderParams
{
Settings & settings;
/** The path of the derivation. */
const StorePath & drvPath;
@@ -2,6 +2,7 @@
///@file
#include "nix/store/store-api.hh"
#include "nix/util/fmt.hh"
namespace nix {
@@ -10,11 +11,11 @@ namespace nix {
*/
struct Package
{
Path path;
std::filesystem::path path;
bool active;
int priority;
Package(const Path & path, bool active, int priority)
Package(const std::filesystem::path & path, bool active, int priority)
: path{path}
, active{active}
, priority{priority}
@@ -25,18 +26,18 @@ struct Package
class BuildEnvFileConflictError : public Error
{
public:
const Path fileA;
const Path fileB;
const std::filesystem::path fileA;
const std::filesystem::path fileB;
int priority;
BuildEnvFileConflictError(const Path fileA, const Path fileB, int priority)
BuildEnvFileConflictError(const std::filesystem::path fileA, const std::filesystem::path fileB, int priority)
: Error(
"Unable to build profile. There is a conflict for the following files:\n"
"\n"
" %1%\n"
" %2%",
fileA,
fileB)
PathFmt(fileA),
PathFmt(fileB))
, fileA(fileA)
, fileB(fileB)
, priority(priority)
@@ -46,6 +47,6 @@ public:
typedef std::vector<Package> Packages;
void buildProfile(const Path & out, Packages && pkgs);
void buildProfile(const std::filesystem::path & out, Packages && pkgs);
} // namespace nix
@@ -12,13 +12,8 @@ struct CommonSSHStoreConfig : virtual StoreConfig
{
using StoreConfig::StoreConfig;
CommonSSHStoreConfig(
nix::Settings & settings,
std::string_view scheme,
const ParsedURL::Authority & authority,
const Params & params);
CommonSSHStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view authority, const Params & params);
CommonSSHStoreConfig(std::string_view scheme, const ParsedURL::Authority & authority, const Params & params);
CommonSSHStoreConfig(std::string_view scheme, std::string_view authority, const Params & params);
Setting<Path> sshKey{
this, "", "ssh-key", "Path to the SSH private key used to authenticate to the remote machine."};
+6 -16
View File
@@ -12,16 +12,15 @@ struct DummyStore;
struct DummyStoreConfig : public std::enable_shared_from_this<DummyStoreConfig>, virtual StoreConfig
{
DummyStoreConfig(nix::Settings & settings, const Params & params)
: StoreConfig(settings, params)
DummyStoreConfig(const Params & params)
: StoreConfig(params)
{
// Disable caching since this a temporary in-memory store.
pathInfoCacheSize = 0;
}
DummyStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view authority, const Params & params)
: DummyStoreConfig(settings, params)
DummyStoreConfig(std::string_view scheme, std::string_view authority, const Params & params)
: DummyStoreConfig(params)
{
if (!authority.empty())
throw UsageError("`%s` store URIs must not contain an authority part %s", scheme, authority);
@@ -91,20 +90,11 @@ namespace nlohmann {
template<>
JSON_IMPL_INNER_TO(nix::DummyStoreConfig);
template<>
struct adl_serializer<nix::ref<nix::DummyStoreConfig>>
{
static nix::ref<nix::DummyStoreConfig> from_json(nix::Settings & settings, const json & json);
};
JSON_IMPL_INNER_FROM(nix::ref<nix::DummyStoreConfig>);
template<>
JSON_IMPL_INNER_TO(nix::DummyStore);
template<>
struct adl_serializer<nix::ref<nix::DummyStore>>
{
static nix::ref<nix::DummyStore> from_json(nix::Settings & settings, const json & json);
};
JSON_IMPL_INNER_FROM(nix::ref<nix::DummyStore>);
} // namespace nlohmann
@@ -182,7 +182,6 @@ struct FileTransferRequest
Headers headers;
std::string expectedETag;
HttpMethod method = HttpMethod::Get;
size_t tries = fileTransferSettings.tries;
unsigned int baseRetryTimeMs = RETRY_TIME_MS_DEFAULT;
ActivityId parentAct;
bool decompress = true;
@@ -422,6 +422,9 @@ public:
ProfileDirsOptions getProfileDirsOptions() const;
};
// FIXME: don't use a global variable.
extern nix::Settings settings;
/**
* Load the configuration (from `nix.conf`, `NIX_CONFIG`, etc.) into the
* given configuration object.
@@ -17,12 +17,9 @@ struct HttpBinaryCacheStoreConfig : std::enable_shared_from_this<HttpBinaryCache
using BinaryCacheStoreConfig::BinaryCacheStoreConfig;
HttpBinaryCacheStoreConfig(
nix::Settings & settings,
std::string_view scheme,
std::string_view cacheUri,
const Store::Config::Params & params);
std::string_view scheme, std::string_view cacheUri, const Store::Config::Params & params);
HttpBinaryCacheStoreConfig(nix::Settings & settings, ParsedURL cacheUri, const Store::Config::Params & params);
HttpBinaryCacheStoreConfig(ParsedURL cacheUri, const Store::Config::Params & params);
ParsedURL cacheUri;
+2 -8
View File
@@ -5,12 +5,6 @@
namespace nix {
class Settings;
PublicKeys getDefaultPublicKeys();
/**
* @todo use more narrow settings, or rethink whether this is a good
* idea at all, vs always associating keys with stores.
*/
PublicKeys getDefaultPublicKeys(const Settings & settings);
} // namespace nix
}
@@ -14,8 +14,7 @@ struct LegacySSHStoreConfig : std::enable_shared_from_this<LegacySSHStoreConfig>
{
using CommonSSHStoreConfig::CommonSSHStoreConfig;
LegacySSHStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view authority, const Params & params);
LegacySSHStoreConfig(std::string_view scheme, std::string_view authority, const Params & params);
#ifndef _WIN32
// Hack for getting remote build log output.
@@ -12,8 +12,7 @@ struct LocalBinaryCacheStoreConfig : std::enable_shared_from_this<LocalBinaryCac
* @param binaryCacheDir `file://` is a short-hand for `file:///`
* for now.
*/
LocalBinaryCacheStoreConfig(
nix::Settings & settings, std::string_view scheme, PathView binaryCacheDir, const Params & params);
LocalBinaryCacheStoreConfig(std::string_view scheme, PathView binaryCacheDir, const Params & params);
Path binaryCacheDir;
@@ -10,7 +10,8 @@ namespace nix {
struct LocalFSStoreConfig : virtual StoreConfig
{
private:
static OptionalPathSetting makeRootDirSetting(LocalFSStoreConfig & self, std::optional<Path> defaultValue)
static Setting<std::optional<std::filesystem::path>>
makeRootDirSetting(LocalFSStoreConfig & self, std::optional<Path> defaultValue)
{
return {
&self,
@@ -30,9 +31,9 @@ public:
*
* @todo Make this less error-prone with new store settings system.
*/
LocalFSStoreConfig(nix::Settings & settings, PathView path, const Params & params);
LocalFSStoreConfig(PathView path, const Params & params);
OptionalPathSetting rootDir = makeRootDirSetting(*this, std::nullopt);
Setting<std::optional<std::filesystem::path>> rootDir = makeRootDirSetting(*this, std::nullopt);
private:
@@ -40,29 +41,29 @@ private:
* An indirection so that we don't need to refer to global settings
* in headers.
*/
static Path getDefaultStateDir(const nix::Settings & settings);
static Path getDefaultStateDir();
/**
* An indirection so that we don't need to refer to global settings
* in headers.
*/
static Path getDefaultLogDir(const nix::Settings & settings);
static Path getDefaultLogDir();
public:
PathSetting stateDir{
Setting<std::filesystem::path> stateDir{
this,
rootDir.get() ? *rootDir.get() + "/nix/var/nix" : getDefaultStateDir(settings),
rootDir.get() ? *rootDir.get() + "/nix/var/nix" : getDefaultStateDir(),
"state",
"Directory where Nix stores state."};
PathSetting logDir{
Setting<std::filesystem::path> logDir{
this,
rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : getDefaultLogDir(settings),
rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : getDefaultLogDir(),
"log",
"directory where Nix stores log files."};
PathSetting realStoreDir{
Setting<std::filesystem::path> realStoreDir{
this, rootDir.get() ? *rootDir.get() + "/nix/store" : storeDir, "real", "Physical path of the Nix store."};
};
@@ -77,7 +78,7 @@ struct alignas(8) /* Work around ASAN failures on i686-linux. */
inline static std::string operationName = "Local Filesystem Store";
const static std::string drvsLogDir;
const static std::filesystem::path drvsLogDir;
LocalFSStore(const Config & params);
@@ -100,7 +101,7 @@ struct alignas(8) /* Work around ASAN failures on i686-linux. */
*/
virtual Path addPermRoot(const StorePath & storePath, const Path & gcRoot) = 0;
virtual Path getRealStoreDir()
virtual std::filesystem::path getRealStoreDir()
{
return config.realStoreDir;
}
@@ -7,15 +7,15 @@ namespace nix {
*/
struct LocalOverlayStoreConfig : virtual LocalStoreConfig
{
LocalOverlayStoreConfig(nix::Settings & settings, const StringMap & params)
: LocalOverlayStoreConfig(settings, "local-overlay", "", params)
LocalOverlayStoreConfig(const StringMap & params)
: LocalOverlayStoreConfig("local-overlay", "", params)
{
}
LocalOverlayStoreConfig(nix::Settings & settings, std::string_view scheme, PathView path, const Params & params)
: StoreConfig(settings, params)
, LocalFSStoreConfig(settings, path, params)
, LocalStoreConfig(settings, scheme, path, params)
LocalOverlayStoreConfig(std::string_view scheme, PathView path, const Params & params)
: StoreConfig(params)
, LocalFSStoreConfig(path, params)
, LocalStoreConfig(scheme, path, params)
{
}
@@ -82,8 +82,7 @@ struct LocalStoreConfig : std::enable_shared_from_this<LocalStoreConfig>,
{
using LocalFSStoreConfig::LocalFSStoreConfig;
LocalStoreConfig(
nix::Settings & settings, std::string_view scheme, std::string_view authority, const Params & params);
LocalStoreConfig(std::string_view scheme, std::string_view authority, const Params & params);
private:
@@ -208,12 +207,12 @@ private:
public:
const Path dbDir;
const Path linksDir;
const Path reservedPath;
const Path schemaPath;
const Path tempRootsDir;
const Path fnTempRoots;
const std::filesystem::path dbDir;
const std::filesystem::path linksDir;
const std::filesystem::path reservedPath;
const std::filesystem::path schemaPath;
const std::filesystem::path tempRootsDir;
const std::filesystem::path fnTempRoots;
private:
@@ -224,7 +223,7 @@ public:
/**
* Hack for build-remote.cc.
*/
PathSet locksHeld;
PathSetNG locksHeld;
/**
* Initialise the local store, upgrading the schema if
+1 -2
View File
@@ -6,7 +6,6 @@
namespace nix {
class Settings;
class Store;
struct Machine;
@@ -68,7 +67,7 @@ struct Machine
* nix::openStore(completeStoreReference())
* ```
*/
ref<Store> openStore(Settings & settings) const;
ref<Store> openStore() const;
/**
* Parse a machine configuration.
+1 -2
View File
@@ -16,7 +16,6 @@
namespace nix {
class Settings;
class StorePath;
/**
@@ -217,7 +216,7 @@ struct ProfileDirsOptions
};
/**
* Create and return the path to a directory suitable for storing the user's
* Create and return the path to a directory suitable for storing the user’s
* profiles.
*/
std::filesystem::path profilesDir(ProfileDirsOptions opts);
Loaded 100 of 201 files, more files were not shown because too many files have changed in this diff. Show more