Add page size system features#12446
Conversation
bcb4839 to
0fc68c3
Compare
1fe2463 to
18057a7
Compare
roberth
left a comment
There was a problem hiding this comment.
This might lead to a mandatoryRejectedSystemFeatures option and machine parameter, or that could be over-engineered.
|
|
||
| - [`rejectSystemFeatures`]{#adv-attr-rejectSystemFeatures}\ | ||
|
|
||
| If a derivation has the `rejectSystemFeatures` attribute, then Nix will only build it on a machine that does not has the corresponding features set in its [`system-features` configuration](@docroot@/command-ref/conf-file.md#conf-system-features). |
There was a problem hiding this comment.
| If a derivation has the `rejectSystemFeatures` attribute, then Nix will only build it on a machine that does not has the corresponding features set in its [`system-features` configuration](@docroot@/command-ref/conf-file.md#conf-system-features). | |
| 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). |
There was a problem hiding this comment.
Thanks for catching that, it's fixed now.
| rejectSystemFeatures = [ "pages-16k" ]; | ||
| ``` | ||
|
|
||
| ensures that the derivation can only be built on a machine which do not have the `pages-16k` feature. |
There was a problem hiding this comment.
| ensures that the derivation can only be built on a machine which do not have the `pages-16k` feature. | |
| ensures that the derivation can only be built on a machine which does not have the `pages-16k` feature. |
| /* Right platform? */ | ||
| if (!parsedDrv->canBuildLocally(worker.store)) | ||
| throw Error("a '%s' with features {%s} is required to build '%s', but I am a '%s' with features {%s}", | ||
| throw Error("a '%s' with features {%s} & not {%s} is required to build '%s', but I am a '%s' with features {%s}", |
There was a problem hiding this comment.
Not pretty when empty, but that was already the case for required ones.
There was a problem hiding this comment.
Yeah, I'm curious how we should handle things when it's empty.
| echo "$output" | grepQuiet builder-build-remote-input-3.sh | ||
| unset output | ||
|
|
||
| # Ensure that input4 was built on store4 due to the required feature. |
There was a problem hiding this comment.
This isn't obvious from the code below. Could you add assertions that simply check what you're saying here?
There was a problem hiding this comment.
I tried getting a test here which would reject builds in the proper way but I'm not confident with the testing framework so I might need guidance.
92050c6 to
c4a6266
Compare
|
It seems that #12292 introduced a conflict. |
75a730b to
0bcf588
Compare
0bcf588 to
589fe7d
Compare
Ericson2314
left a comment
There was a problem hiding this comment.
I'm late to this, but I don't think "reject system features" is a good framing of this. I think it's better to keep "positive" rather than "negative reasoning.
For the case of page size, there is set if page sizes which are allowed, and the system is required to have its page sizes be in the set.
|
The problem I had with A good example of this is if the minimum page size is 16 but a derivation supports the minimum of 4k, the builder would not have the 4k page size feature and would fail saying that it doesn't have the feature. |
|
Yes, it is better to add "or" than "not". |
|
The problem is how to do an |
|
@RossComputerGuy I don't want to delay this too much, but with structured attrs that gets much easier. |
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2025-05-04-nix-team-meeting-minutes-230/65206/1 |
Motivation
Fixes #12426
Context
Prevents issues like NixOS/nixpkgs#348660 from occurring by adding system features which describe the page size. This has the added benefit of systems with multiple builders of utilizing only compatible page sizes.
Testing this PR involves building this PR and running Nix to build any derivation inside this branch of nixpkgs: https://github.com/RossComputerGuy/nixpkgs/tree/feat/page-size
It should not fail with this error:
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.