Guard the local overlay store behind an experimental feature

This commit is contained in:
John Ericson 2023-08-02 20:30:42 -04:00
parent 3fc838c8a8
commit 4b9a621812
5 changed files with 19 additions and 3 deletions

View file

@ -56,6 +56,11 @@ struct LocalOverlayStoreConfig : virtual LocalStoreConfig
const std::string name() override { return "Experimental Local Overlay Store"; } const std::string name() override { return "Experimental Local Overlay Store"; }
std::optional<ExperimentalFeature> experimentalFeature() const override
{
return ExperimentalFeature::LocalOverlayStore;
}
std::string doc() override std::string doc() override
{ {
return return

View file

@ -1444,7 +1444,9 @@ std::shared_ptr<Store> openFromNonUri(const std::string & uri, const Store::Para
} else if (uri == "local") { } else if (uri == "local") {
return std::make_shared<LocalStore>(params); return std::make_shared<LocalStore>(params);
} else if (uri == "local-overlay") { } else if (uri == "local-overlay") {
return std::make_shared<LocalOverlayStore>(params); auto store = std::make_shared<LocalOverlayStore>(params);
experimentalFeatureSettings.require(store->experimentalFeature());
return store;
} else if (isNonUriPath(uri)) { } else if (isNonUriPath(uri)) {
Store::Params params2 = params; Store::Params params2 = params;
params2["root"] = absPath(uri); params2["root"] = absPath(uri);
@ -1512,6 +1514,7 @@ ref<Store> openStore(const std::string & uri_,
params.insert(uriParams.begin(), uriParams.end()); params.insert(uriParams.begin(), uriParams.end());
if (auto store = openFromNonUri(uri, params)) { if (auto store = openFromNonUri(uri, params)) {
experimentalFeatureSettings.require(store->experimentalFeature());
store->warnUnknownSettings(); store->warnUnknownSettings();
return ref<Store>(store); return ref<Store>(store);
} }

View file

@ -12,7 +12,7 @@ struct ExperimentalFeatureDetails
std::string_view description; std::string_view description;
}; };
constexpr std::array<ExperimentalFeatureDetails, 15> xpFeatureDetails = {{ constexpr std::array<ExperimentalFeatureDetails, 16> xpFeatureDetails = {{
{ {
.tag = Xp::CaDerivations, .tag = Xp::CaDerivations,
.name = "ca-derivations", .name = "ca-derivations",
@ -228,6 +228,13 @@ constexpr std::array<ExperimentalFeatureDetails, 15> xpFeatureDetails = {{
Allow the use of the `read-only` parameter in [local store](@docroot@/command-ref/new-cli/nix3-help-stores.md#local-store) URIs. Allow the use of the `read-only` parameter in [local store](@docroot@/command-ref/new-cli/nix3-help-stores.md#local-store) URIs.
)", )",
}, },
{
.tag = Xp::LocalOverlayStore,
.name = "local-overlay-store",
.description = R"(
Allow the use of [local overlay store](@docroot@/command-ref/new-cli/nix3-help-stores.md#local-overlay-store).
)",
},
}}; }};
static_assert( static_assert(

View file

@ -32,6 +32,7 @@ enum struct ExperimentalFeature
DynamicDerivations, DynamicDerivations,
ParseTomlTimestamps, ParseTomlTimestamps,
ReadOnlyLocalStore, ReadOnlyLocalStore,
LocalOverlayStore,
}; };
/** /**

View file

@ -16,7 +16,7 @@ setupConfig () {
addConfig "build-users-group = " addConfig "build-users-group = "
} }
enableFeatures "local-overlay-store"
storeDirs () { storeDirs () {
# Attempt to create store dirs on tmpfs volume. # Attempt to create store dirs on tmpfs volume.