forked from lix-project/lix
Stabilize discard-references
It has been there for a few releases now (landed in 2.14.0), doesn't seem to cause any major issue and is wanted in a few places (https://github.com/NixOS/nix/pull/7087#issuecomment-1544471346).
This commit is contained in:
parent
5df0f1755f
commit
ad410abbe0
|
@ -320,16 +320,6 @@ Derivations can declare some infrequently used optional attributes.
|
||||||
```
|
```
|
||||||
|
|
||||||
- [`unsafeDiscardReferences`]{#adv-attr-unsafeDiscardReferences}\
|
- [`unsafeDiscardReferences`]{#adv-attr-unsafeDiscardReferences}\
|
||||||
> **Warning**
|
|
||||||
> This attribute is part of an [experimental feature](@docroot@/contributing/experimental-features.md).
|
|
||||||
>
|
|
||||||
> To use this attribute, you must enable the
|
|
||||||
> [`discard-references`](@docroot@/contributing/experimental-features.md#xp-feature-discard-references) experimental feature.
|
|
||||||
> For example, in [nix.conf](../command-ref/conf-file.md) you could add:
|
|
||||||
>
|
|
||||||
> ```
|
|
||||||
> extra-experimental-features = discard-references
|
|
||||||
> ```
|
|
||||||
|
|
||||||
When using [structured attributes](#adv-attr-structuredAttrs), the
|
When using [structured attributes](#adv-attr-structuredAttrs), the
|
||||||
attribute `unsafeDiscardReferences` is an attribute set with a boolean value for each output name.
|
attribute `unsafeDiscardReferences` is an attribute set with a boolean value for each output name.
|
||||||
|
|
|
@ -10,3 +10,9 @@
|
||||||
- [`builtins.toJSON`](@docroot@/language/builtins.md#builtins-parseFlakeRef) now prints [--show-trace](@docroot@/command-ref/conf-file.html#conf-show-trace) items for the path in which it finds an evaluation error.
|
- [`builtins.toJSON`](@docroot@/language/builtins.md#builtins-parseFlakeRef) now prints [--show-trace](@docroot@/command-ref/conf-file.html#conf-show-trace) items for the path in which it finds an evaluation error.
|
||||||
|
|
||||||
- Error messages regarding malformed input to [`derivation add`](@docroot@/command-ref/new-cli/nix3-derivation-add.md) are now clearer and more detailed.
|
- Error messages regarding malformed input to [`derivation add`](@docroot@/command-ref/new-cli/nix3-derivation-add.md) are now clearer and more detailed.
|
||||||
|
|
||||||
|
- The `discard-references` feature has been stabilized.
|
||||||
|
This means that the
|
||||||
|
[unsafeDiscardReferences](@docroot@/contributing/experimental-features.md#xp-feature-discard-references)
|
||||||
|
attribute is no longer guarded by an experimental flag and can be used
|
||||||
|
freely.
|
||||||
|
|
|
@ -2307,7 +2307,6 @@ SingleDrvOutputs LocalDerivationGoal::registerOutputs()
|
||||||
bool discardReferences = false;
|
bool discardReferences = false;
|
||||||
if (auto structuredAttrs = parsedDrv->getStructuredAttrs()) {
|
if (auto structuredAttrs = parsedDrv->getStructuredAttrs()) {
|
||||||
if (auto udr = get(*structuredAttrs, "unsafeDiscardReferences")) {
|
if (auto udr = get(*structuredAttrs, "unsafeDiscardReferences")) {
|
||||||
experimentalFeatureSettings.require(Xp::DiscardReferences);
|
|
||||||
if (auto output = get(*udr, outputName)) {
|
if (auto output = get(*udr, outputName)) {
|
||||||
if (!output->is_boolean())
|
if (!output->is_boolean())
|
||||||
throw Error("attribute 'unsafeDiscardReferences.\"%s\"' of derivation '%s' must be a Boolean", outputName, drvPath.to_string());
|
throw Error("attribute 'unsafeDiscardReferences.\"%s\"' of derivation '%s' must be a Boolean", outputName, drvPath.to_string());
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct ExperimentalFeatureDetails
|
||||||
std::string_view description;
|
std::string_view description;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr std::array<ExperimentalFeatureDetails, 15> xpFeatureDetails = {{
|
constexpr std::array<ExperimentalFeatureDetails, 14> xpFeatureDetails = {{
|
||||||
{
|
{
|
||||||
.tag = Xp::CaDerivations,
|
.tag = Xp::CaDerivations,
|
||||||
.name = "ca-derivations",
|
.name = "ca-derivations",
|
||||||
|
@ -182,15 +182,6 @@ constexpr std::array<ExperimentalFeatureDetails, 15> xpFeatureDetails = {{
|
||||||
the [`use-cgroups`](#conf-use-cgroups) setting for details.
|
the [`use-cgroups`](#conf-use-cgroups) setting for details.
|
||||||
)",
|
)",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.tag = Xp::DiscardReferences,
|
|
||||||
.name = "discard-references",
|
|
||||||
.description = R"(
|
|
||||||
Allow the use of the [`unsafeDiscardReferences`](@docroot@/language/advanced-attributes.html#adv-attr-unsafeDiscardReferences) attribute in derivations
|
|
||||||
that use [structured attributes](@docroot@/language/advanced-attributes.html#adv-attr-structuredAttrs). This disables scanning of outputs for
|
|
||||||
runtime dependencies.
|
|
||||||
)",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.tag = Xp::DaemonTrustOverride,
|
.tag = Xp::DaemonTrustOverride,
|
||||||
.name = "daemon-trust-override",
|
.name = "daemon-trust-override",
|
||||||
|
|
|
@ -27,7 +27,6 @@ enum struct ExperimentalFeature
|
||||||
ReplFlake,
|
ReplFlake,
|
||||||
AutoAllocateUids,
|
AutoAllocateUids,
|
||||||
Cgroups,
|
Cgroups,
|
||||||
DiscardReferences,
|
|
||||||
DaemonTrustOverride,
|
DaemonTrustOverride,
|
||||||
DynamicDerivations,
|
DynamicDerivations,
|
||||||
ParseTomlTimestamps,
|
ParseTomlTimestamps,
|
||||||
|
|
|
@ -42,8 +42,10 @@ nix-build -o $RESULT check-refs.nix -A test7
|
||||||
nix-build -o $RESULT check-refs.nix -A test10
|
nix-build -o $RESULT check-refs.nix -A test10
|
||||||
|
|
||||||
if isDaemonNewer 2.12pre20230103; then
|
if isDaemonNewer 2.12pre20230103; then
|
||||||
|
if ! isDaemonNewer 2.16.0; then
|
||||||
enableFeatures discard-references
|
enableFeatures discard-references
|
||||||
restartDaemon
|
restartDaemon
|
||||||
|
fi
|
||||||
|
|
||||||
# test11 should succeed.
|
# test11 should succeed.
|
||||||
test11=$(nix-build -o $RESULT check-refs.nix -A test11)
|
test11=$(nix-build -o $RESULT check-refs.nix -A test11)
|
||||||
|
|
Loading…
Reference in a new issue