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, or default* moved to something else.
Especially the unknown attributes can be annoying, even more those that evolved into a quasi-standard, like lib (even used by nixpkgs) or homeModules and homeConfigurations.
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 use nixChecks in the following examples.
Once nix flake check encounters an attribute foo it doesn't know how to check, it calls self.nixChecks.foo self.foo.
nixChecks can then use arbitrary nix functions to verify the value of foo to match the requirements and issue informative messages, warnings or errors. It should be avoided to use traceing functions from the nixChecks though it lies in the nature of the checks, that they require at least partial evaluation of the values, and therefore might trigger traceing calls within the value.
A message is either a set with level and message (where level 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.
Is your feature request related to a problem? Please describe.
When running
nix flake checkone 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) orhomeModulesandhomeConfigurations.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
checksfor this, though that is already used for something else. In lack of a better name, I therefore usenixChecksin the following examples.Once
nix flake checkencounters an attributefooit doesn't know how to check, it callsself.nixChecks.foo self.foo.nixCheckscan then use arbitrary nix functions to verify the value offooto match the requirements and issue informative messages, warnings or errors. It should be avoided to usetraceing functions from thenixChecksthough it lies in the nature of the checks, that they require at least partial evaluation of the values, and therefore might triggertraceing calls within the value.A message is either a set with
levelandmessage(wherelevelis"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 checkshould 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.