From e3c289dbe945415367dc1f54f85ad2452f5a97e0 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Sat, 17 Aug 2024 20:55:41 +0200 Subject: libutil/config: unify path setting types There have been multiple setting types for paths that are supposed to be canonicalised, depending on whether zero or one, one, or any number of paths is to be specified. Naturally, they behaved in slightly different ways in the code. Simplify things by unifying them and removing special behaviour (mainly the "multiple paths type can coerce to boolean" thing). Change-Id: I7c1ce95e9c8e1829a866fb37d679e167811e9705 --- src/libstore/globals.hh | 2 +- src/libstore/local-fs-store.hh | 8 ++++---- src/libstore/store-api.hh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index 4709ac715..aba99d969 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -634,7 +634,7 @@ public: line. )"}; - OptionalPathSetting diffHook{ + PathsSetting> diffHook{ this, std::nullopt, "diff-hook", R"( Absolute path to an executable capable of diffing build diff --git a/src/libstore/local-fs-store.hh b/src/libstore/local-fs-store.hh index 56de47424..5b7a149cb 100644 --- a/src/libstore/local-fs-store.hh +++ b/src/libstore/local-fs-store.hh @@ -11,21 +11,21 @@ struct LocalFSStoreConfig : virtual StoreConfig { using StoreConfig::StoreConfig; - const OptionalPathSetting rootDir{this, std::nullopt, + const PathsSetting> rootDir{this, std::nullopt, "root", "Directory prefixed to all other paths."}; - const PathSetting stateDir{this, + const PathsSetting stateDir{this, rootDir.get() ? *rootDir.get() + "/nix/var/nix" : settings.nixStateDir, "state", "Directory where Lix will store state."}; - const PathSetting logDir{this, + const PathsSetting logDir{this, rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : settings.nixLogDir, "log", "directory where Lix will store log files."}; - const PathSetting realStoreDir{this, + const PathsSetting realStoreDir{this, rootDir.get() ? *rootDir.get() + "/nix/store" : storeDir, "real", "Physical path of the Nix store."}; }; diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh index 25bc0c823..efd0e4d9b 100644 --- a/src/libstore/store-api.hh +++ b/src/libstore/store-api.hh @@ -144,7 +144,7 @@ struct StoreConfig : public Config return std::nullopt; } - const PathSetting storeDir_{this, settings.nixStore, + const PathsSetting storeDir_{this, settings.nixStore, "store", R"( Logical location of the Nix store, usually -- cgit v1.2.3