-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Policy for allowing flake outputs in nix flake check
#6381
Comments
I think we might only check the a few blessed outputs against their designated schema, and simply ignore the rest. if someone have an additional output in their flake, they do mean that, no need for a warning to annoy them. |
It might be a good idea to bless an outputs which starts to become common in flake projects; like |
In addition to showing, there are differences in how they are evaluated. For example, hydraJobs accepts a nested attrset, legacyPackages will ignore some errors. There are times when people want nested apps, or nested lib, or to be more lenient with errors and will re-use this special behavior. We should consider how to either allow flake writers to specify the behavior or to remove how they are special. (Looking for consistency) |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/custom-flake-outputs-for-checks/18877/5 |
A few ideas:
|
This might be a good means for flake-parts to implement global assertions tl;dr undue strictness in "prod" attrs is bad for perf and errors can block users For some checks we don't want to perform them unless absolutely necessary, because otherwise assertions may cause all of a flake to be evaluated even when only a single attribute is needed by the user. Worse, the user may have a flake that's in a partially broken state, and the strictness induced by the assertions could block them from recovering, even if the attributes needed for recovery (e.g. the dev shell) would evaluate if it wasn't for the assertions.
flake-parts achieves this with the module system. It's the most widely used type system for Nix. That said, I wouldn't go as far as to make Nix Flakes require the module system to function. Perhaps it'd make sense for such a framework to set a flake output attribute that signifies that the framework handles the checks; specifically disabling the unknown output attribute warnings. |
It's common for flake library authors to have one use different, custom nix flake outputs. deploy-rs uses deploy, nixops uses nixops, home-manager modules sometimes use homeModules or hmModules. There's a nix-darwin thing, too. There seemed to be some consensus on NixOS#6381 that it's reasonable to reduce the current warn level below warning, so I've replaced it with a 'debug' log.
Will be closed by #8892 |
nix flake check
checks for “known” flake outputs (packages
,devShells
, etc..).Most of these are things that Nix cares about, some are NixOS-specific things (
nixosConfigurations
,nixosModules
, etc..), but there’s also a number of projects out there that want their own output fields (home-manager
ornixops
for example).It would be nice to have a policy to decide which outputs to bless in
nix flake check
The text was updated successfully, but these errors were encountered: