1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-03-06 00:46:50 +00:00
flake-parts/modules/checks.nix

46 lines
873 B
Nix
Raw Normal View History

2021-10-27 11:05:52 +02:00
{ config, lib, flake-modules-core-lib, ... }:
let
inherit (lib)
filterAttrs
genAttrs
mapAttrs
mkOption
optionalAttrs
types
;
in
{
options = {
flake = {
checks = mkOption {
type = types.lazyAttrsOf (types.lazyAttrsOf types.package);
default = { };
};
};
};
config = {
flake.checks =
mapAttrs
(k: v: v.checks)
(filterAttrs
(k: v: v.checks != null)
(genAttrs config.systems config.perSystem)
);
perInput = system: flake:
optionalAttrs (flake?checks.${system}) {
checks = flake.checks.${system};
};
perSystem = system: { config, ... }: {
_file = ./checks.nix;
options = {
checks = mkOption {
type = types.lazyAttrsOf types.package;
default = { };
};
};
};
};
}