-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Extend nix flake check
to support custom attributes
#6453
Comments
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/6 |
I’m not entirely convinced since it means that each flake would need to specify its own outputs schema, which would be a pain in most cases − for example, I’d be very happy to have Maybe (or in addition?) |
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/21 |
There are several similar situations where one would like the behavior of a well-known output path to be applied to another one or extended. random brainstorm:
I can see this quickly getting out of hand. |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/what-would-you-like-to-see-improved-in-nix-cli-experience/24012/2 |
Maybe the ability to disable the warning via a config setting like EDIT: Could also consider an option like |
Is your feature request related to a problem? Please describe.
When running
nix flake check
one regularly sees warnings emitted by nix about unknown attributes, ordefault*
moved to something else.Especially the unknown attributes can be annoying, even more those that evolved into a quasi-standard, like
lib
(even used bynixpkgs
) orhomeModules
andhomeConfigurations
.Describe the solution you'd like
There might be yet another flake output which is not a derivation but instead a function that takes and arbitrary value and returns a list of string or set of string.
I initially wanted to use
checks
for this, though that is already used for something else. In lack of a better name, I therefore usenixChecks
in the following examples.Once
nix flake check
encounters an attributefoo
it doesn't know how to check, it callsself.nixChecks.foo self.foo
.nixChecks
can then use arbitrary nix functions to verify the value offoo
to match the requirements and issue informative messages, warnings or errors. It should be avoided to usetrace
ing functions from thenixChecks
though it lies in the nature of the checks, that they require at least partial evaluation of the values, and therefore might triggertrace
ing calls within the value.A message is either a set with
level
andmessage
(wherelevel
is"info"
,"warning"
, or"error"
.) or alternaively just a string, which is assumed to be the message for a warning then.Whenever at least one error got emitted, the exit code of
nix flake check
should be non-zero.Describe alternatives you've considered
External programs that would check validity of custom attributes while continue to ignore warnings issued by
nix flake check
, or not run it at all.The text was updated successfully, but these errors were encountered: