From 589fe7d4d8f367991647545245547a0294c3fd1e Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Fri, 14 Feb 2025 12:40:19 -0800 Subject: [PATCH] Document the reject systems feature --- doc/manual/source/language/advanced-attributes.md | 12 ++++++++++++ src/libstore/globals.hh | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/manual/source/language/advanced-attributes.md b/doc/manual/source/language/advanced-attributes.md index c384e956af6..1c5c24e564d 100644 --- a/doc/manual/source/language/advanced-attributes.md +++ b/doc/manual/source/language/advanced-attributes.md @@ -370,6 +370,18 @@ Derivations can declare some infrequently used optional attributes. ensures that the derivation can only be built on a machine with the `kvm` feature. +- [`rejectSystemFeatures`]{#adv-attr-rejectSystemFeatures}\ + + If a derivation has the `rejectSystemFeatures` attribute, then Nix will only build it on a machine that does not have the corresponding features set in its [`system-features` configuration](@docroot@/command-ref/conf-file.md#conf-system-features). + + For example, setting + + ```nix + rejectSystemFeatures = [ "pages-16k" ]; + ``` + + ensures that the derivation can only be built on a machine which does not have the `pages-16k` feature. + [xp-feature-ca-derivations]: @docroot@/development/experimental-features.md#xp-feature-ca-derivations [xp-feature-dynamic-derivations]: @docroot@/development/experimental-features.md#xp-feature-dynamic-derivations [xp-feature-git-hashing]: @docroot@/development/experimental-features.md#xp-feature-git-hashing diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh index f62644ff125..e019214ab65 100644 --- a/src/libstore/globals.hh +++ b/src/libstore/globals.hh @@ -304,7 +304,7 @@ public: 6. A comma-separated list of supported [system features](#conf-system-features). - A machine will only be used to build a derivation if all the features in the derivation's [`requiredSystemFeatures`](@docroot@/language/advanced-attributes.html#adv-attr-requiredSystemFeatures) attribute are supported by that machine. + A machine will only be used to build a derivation if all the features in the derivation's [`requiredSystemFeatures`](@docroot@/language/advanced-attributes.html#adv-attr-requiredSystemFeatures) attribute are supported by that machine and does not have any features in [`rejectSystemFeatures`](@docroot@/language/advanced-attributes.html#adv-attr-rejectSystemFeatures). 7. A comma-separated list of required [system features](#conf-system-features).