Skip to content

Include assertions and warnings in flake-parts? #230

Open
@Skarlett

Description

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 ?

mkFlake = args: module:
  let
    eval = flake-parts-lib.evalFlakeModule args module;
    failedAssertions = map (x: x.message) (filter (x: !x.assertion) eval.config.assertions);
 in
    lib.warnIf (failedAssertions != []) (lib.stringConcatSep "\n" failedAssertions)  
    eval.config.flake;

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions