Skip to content

libstore: structured diagnostics for local build rejection#15266

Merged
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:fix-maxjobs-error
Feb 17, 2026
Merged

libstore: structured diagnostics for local build rejection#15266
Ericson2314 merged 1 commit intoNixOS:masterfrom
obsidiansystems:fix-maxjobs-error

Conversation

@amaanq
Copy link
Member

@amaanq amaanq commented Feb 16, 2026

Motivation

When max-jobs = 0 and no remote builders are available, Nix reported
"required system or feature not available" even though the system and
features matched fine. The canBuildLocally lambda returned a plain
bool, conflating a configuration knob (max-jobs = 0) with actual
incompatibility (wrong platform, missing features). It also short-circuited
on the first failing check, so a user with both a platform mismatch and
missing features would only see one of the two.

This commit replaces the bool with a LocalBuildRejection struct whose
WrongLocalStore variant collects all applicable failures into
badPlatform, missingFeatures, and an orthogonal maxJobsZero flag.
Platform mismatch and missing features now produce separate error
paragraphs, and all applicable reasons appear in a single message.

The local-build capability check also now returns
std::variant<LocalBuildCapability, LocalBuildRejection>, bundling
the LocalStore & and optional ExternalBuilder * together.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Feb 16, 2026
@amaanq amaanq changed the title Merge pull request NixOS#6902 from centromere/optional-nixpkgs build: distinguish max-jobs=0 from system mismatch in error message Feb 17, 2026
@amaanq amaanq force-pushed the fix-maxjobs-error branch 9 times, most recently from acd3730 to 5f3a0ff Compare February 17, 2026 17:43
When `max-jobs = 0` and no remote builders are available, Nix reported
"required system or feature not available" even though the system and
features matched fine. The `canBuildLocally` lambda returned a plain
`bool`, conflating a configuration knob (`max-jobs = 0`) with actual
incompatibility (wrong platform, missing features). It also short-circuited
on the first failing check, so a user with both a platform mismatch and
missing features would only see one of the two.

This commit replaces the bool with a `LocalBuildRejection` struct whose
`WrongLocalStore` variant collects all applicable failures into
`badPlatform`, `missingFeatures`, and an orthogonal `maxJobsZero` flag.
Platform mismatch and missing features now produce separate error
paragraphs, and all applicable reasons appear in a single message.

The local-build capability check also now returns
`std::variant<LocalBuildCapability, LocalBuildRejection>`, bundling
the `LocalStore &` and optional `ExternalBuilder *` together.
@amaanq amaanq changed the title build: distinguish max-jobs=0 from system mismatch in error message libstore: structured diagnostics for local build rejection Feb 17, 2026
@Ericson2314 Ericson2314 added this pull request to the merge queue Feb 17, 2026
Merged via the queue into NixOS:master with commit c3f0670 Feb 17, 2026
16 checks passed
@Ericson2314 Ericson2314 deleted the fix-maxjobs-error branch February 17, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message when local build is rejected with max-jobs = 0 is unclear

2 participants