Skip to content

lib/modules: Report error for unsupported t // { check = ...; }#454964

Merged
roberth merged 1 commit intoNixOS:masterfrom
roberth:check-check
Oct 28, 2025
Merged

lib/modules: Report error for unsupported t // { check = ...; }#454964
roberth merged 1 commit intoNixOS:masterfrom
roberth:check-check

Conversation

@roberth
Copy link
Member

@roberth roberth commented Oct 23, 2025

check can have a new place since the introduction of merge.v2. This makes the t // { check = ...; } idiom unreliable.

In this PR we add checks to detect and report this in cases where it breaks.

merge.v2 introduced in:

Real world case: hercules-ci-effects

I was lucky to unit test my type in a way that triggers it. Many people don't unit test types (I hope not most 🤨), and they'll have a harder time to figure this out.

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@roberth roberth changed the title lib/modules: Report error for unsupported t // { check = ...; }` lib/modules: Report error for unsupported t // { check = ...; } Oct 23, 2025
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 6.topic: module system About "NixOS" module system internals 6.topic: lib The Nixpkgs function library labels Oct 23, 2025
@nix-owners nix-owners bot requested review from hsjobeki and infinisil October 23, 2025 17:03
`check` can have a new place since the introduction of
merge.v2. This makes the // { check = ... } idiom unreliable.

In this PR we add checks to detect and report this.

merge.v2 introduced in:
NixOS#391544

Real world case:
https://hercules-ci.com/github/hercules-ci/hercules-ci-effects/jobs/875
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 23, 2025
@roberth roberth added this pull request to the merge queue Oct 28, 2025
Merged via the queue into NixOS:master with commit 5869611 Oct 28, 2025
29 of 31 checks passed
@roberth roberth deleted the check-check branch October 28, 2025 16:44
khaneliman added a commit to khaneliman/home-manager that referenced this pull request Oct 30, 2025
The dagOf type was using an ad-hoc `type // { check = ...; }` pattern
via `inherit (attrEquivalent) check`, which is incompatible with throw
introduced in NixOS/nixpkgs#454964.

This commit properly implements the v2 merge protocol for dagOf by:

- Making `check` a functor with `isV2MergeCoherent = true` that
  delegates to the underlying attrsOf type's check function
- Making `merge` a functor with a `v2` attribute that properly
  delegates to the underlying type's v2 merge implementation

This ensures compatibility with the v2 merge mechanism while
maintaining all existing dagOf functionality.

Fixes evaluation errors like:
  error: The option '...' has a type `DAG of X' that uses
  an ad-hoc `type // { check = ...; }' override, which is
  incompatible with the v2 merge mechanism.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: lib The Nixpkgs function library 6.topic: module system About "NixOS" module system internals 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants