Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pure-storepath-builtin experimental feature #12141

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/manual/rl-next/pure-storepath-builtin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
synopsis: "Add pure-storepath-builtin experimental feature"
issues: [ 5868 ]
prs: [ 12141 ]
---

The `pure-storepath-builtin` [experimental feature](@docroot@/language/builtins.md) was added, which controls whether [`storePath`](@docroot@/language/builtins.md#builtins-storePath) should be allowed in pure evaluation mode. If the `pure-storepath-builtin`
experimental feature is enabled, `storePath` will no longer error when run in pure evaluation mode.

This is intended as a stop-gap solution while the correct behaviour of `storePath` is debated in the linked issue.
2 changes: 1 addition & 1 deletion src/libexpr/primops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ static RegisterPrimOp primop_toPath({
corner cases. */
static void prim_storePath(EvalState & state, const PosIdx pos, Value * * args, Value & v)
{
if (state.settings.pureEval)
if (state.settings.pureEval && !experimentalFeatureSettings.isEnabled(Xp::PureStorePathBuiltin))
state.error<EvalError>(
"'%s' is not allowed in pure evaluation mode",
"builtins.storePath"
Expand Down
13 changes: 13 additions & 0 deletions src/libutil/experimental-features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,19 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
)",
.trackingUrl = "https://github.com/NixOS/nix/milestone/39",
},
{
.tag = Xp::PureStorePathBuiltin,
.name = "pure-storepath-builtin",
.description = R"(
Allow the use of [`storePath`](@docroot@/language/builtins.md#builtins-storePath)
in pure evaluation mode. No consensus has been found as to whether `storePath`
should be considered pure or impure, see the following issue:

https://github.com/NixOS/nix/issues/5868
)",
// NOTE: This is not a milestone, since "tracking" this experimental feature really consists of discussing whether storePath should be pure or not.
.trackingUrl = "https://github.com/NixOS/nix/issues/5868",
},
{
.tag = Xp::ParseTomlTimestamps,
.name = "parse-toml-timestamps",
Expand Down
1 change: 1 addition & 0 deletions src/libutil/experimental-features.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum struct ExperimentalFeature
Cgroups,
DaemonTrustOverride,
DynamicDerivations,
PureStorePathBuiltin,
ParseTomlTimestamps,
ReadOnlyLocalStore,
LocalOverlayStore,
Expand Down
Loading