-
Notifications
You must be signed in to change notification settings - Fork 42
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
Include assertions
and warnings
in flake-parts?
#230
Comments
Assertions have some conflicting requirements:
NixOS assertions mostly avoid these conflicts by only triggering the assertions in Flakes are different though. We don't have a single flake output that is always evaluated, except for the root attribute set of the outputs, but that's costly in terms of performance, and it will still cause infinite recursions when using the flake So I don't think I suppose one thing we could try is make the assertions hierarchical, so that you can control which attribute paths trigger which assertions. {
options.evalChecks = mkOption { type = fix attrsOf // { description = "attrsOf (attrsOf (attrsOf ...))"; }; };
} let
mirrorSeq = checks: ret: builtins.seq checks (mapAttrs (k: v: mirrorSeq checks.${k} v) ret); {
evalChecks.packages.default = lib.warnIf (! (config.packages.default?meta)) "packages.default.meta is not defined" {};
evalChecks.packages = lib.warnIf (config.packages?internal) "packages.internal exists. Is foobar2nix acting up?" {};
}
|
We now have partitions. Putting |
I suppose you could, but it does duplicate the whole module evaluation. What is the benefit over, say, triggering the checks as part of a particular attribute, such as an empty definition for |
I see. Settings |
I know that flake-parts is designed to be very minimal and strive to be as close to flakes as possible.
But would you consider the inclusion of
config.assertions
&config.warnings
?I believe the impl would look something like this.
helpful links:
https://github.com/NixOS/nixpkgs/blob/ab35d52e8a1f75a2b5a1bad575e6973f3c9605c7/nixos/modules/misc/assertions.nix
https://github.com/NixOS/nixpkgs/blob/ab35d52e8a1f75a2b5a1bad575e6973f3c9605c7/nixos/modules/system/activation/top-level.nix#L64
The text was updated successfully, but these errors were encountered: