Skip to content

meta/problems: add hostPlatform to genCheckProblems#113

Open
andir wants to merge 8 commits into
andir/meta-problems-unsupported-basedfrom
andir/meta-problems-unsupported
Open

meta/problems: add hostPlatform to genCheckProblems#113
andir wants to merge 8 commits into
andir/meta-problems-unsupported-basedfrom
andir/meta-problems-unsupported

Conversation

@andir

@andir andir commented Jun 11, 2026

Copy link
Copy Markdown

This will enable future work where e.g. unsupported platform errors
can be handled with the new problems framework.<!--
^ Please summarise the changes you have done and explain why they are necessary here ^

For package updates please link to a changelog or describe changes, this helps your fellow maintainers discover breaking updates.
For new packages please briefly describe the package or provide a link to its homepage.
-->

Things done

This will enable future work where e.g. unsupported platform errors
can be handled with the new problems framework.

andir added 8 commits June 11, 2026 13:05
This unclutters the file a little and makes it easier to pass them all
on as a collection. This will be helpful in the migration from check
into meta.problems where we generally want to emit the (almost)
identical error and retain all the remediation information without
duplicating the text.
Previously problems only gave a hint at how to define generic problem
handlers. Some of our problems also have different (legacy?) ways to
deal with them. While we probably want to move to a more uniform
handling we should keep the escape hatches that we previously
provided (config attributes, env vars) and at the same time continue
provide the guidance, until it is properly deprecated.

Currently there are no problems emitting remediation information and
they are currently only included in the warnings. A TODO has been
added to the error message as that requires further refactoring.
This will enable future work where e.g. unsupported platform errors
can be handled with the new problems framework.
This allows the problems to depend on the current hostPlatform rather
than just on the attributes passed to the functions.

In a future change we can then use the hostSystem to implement the
unsupportedSystem which will then become a meta.problem rather than an
unconditional eval error.
The idea here being that we don't have to return a `kindName` anymore
since we can only ever have one implementation of a kind anyway. The
previous implementation would silently shadow previous problems of the
same kind.

Notes:
  * a builtins.filterMapAttrs would be nice to remove a few extra
  copies but the new code doesn't seem to be slower. There is a PR
  on Nix to introduce filterAttrs which is close and could maybe
  steered the right way as filterMap vs filter is just the map+filter
  function arg:
  https://github.com/NixOS/nix/pull/15100/files
This moves the unsupported platform support into the meta.problems
code while retaining all the typical (legacy?) escape hatches. Benefit
of this work is that the generic problem handlers can be used to deal
with the errors instead of just blanket opt-outs. An example use case
of putting this on warn instead of error would be when porting to a
new platform. You might want to attempt compiling all packages but at
the same time want to know which ones are actually supposedly
unsupported (so you can later on fix their platform(s) attribute).
@andir andir force-pushed the andir/meta-problems-unsupported branch from 5e40604 to fa4b43e Compare June 11, 2026 11:34
@ConnorBaker

Copy link
Copy Markdown

@andir for what it's worth, your work should integrate nicely with the stuff I'm preparing in NixOS#533181. Happy to chat if you have any questions about how I intend to use it -- it's one of the gaps in the current meta.problems implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants