summaryrefslogtreecommitdiff
path: root/module.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-21 18:54:59 -0500
committerseth <[email protected]>2023-12-21 18:54:59 -0500
commit648620fcae21a93a86275fc87a28732f91737725 (patch)
tree81f305973c8a30c3662499c791e4a32f08801ceb /module.nix
parentf1de38cfea711e9a788794b5a658298b4062defb (diff)
module: add exclude option
Diffstat (limited to 'module.nix')
-rw-r--r--module.nix31
1 files changed, 20 insertions, 11 deletions
diff --git a/module.nix b/module.nix
index aa1a160..8c7cb02 100644
--- a/module.nix
+++ b/module.nix
@@ -7,17 +7,13 @@ workflowLib': {
cfg = config.githubWorkflowGenerator;
inherit
- (builtins)
+ (lib)
attrNames
+ concatLists
elem
- ;
-
- inherit
- (lib)
filter
- getAttrs
- mapAttrsToList
mdDoc
+ mkIf
mkOption
literalExpression
types
@@ -25,7 +21,7 @@ workflowLib': {
workflowLib = workflowLib' (
{inherit self;}
- // lib.mkIf (cfg.platforms != {}) {
+ // mkIf (cfg.platforms != {}) {
inherit (cfg) platforms;
}
);
@@ -63,12 +59,12 @@ workflowLib': {
systems = mkOption {
description = mdDoc "list of systems to build an output for";
type = types.listOf types.str;
- default = builtins.attrNames cfg.platforms;
+ default = attrNames cfg.platforms;
};
};
};
- jobs = lib.concatLists (
+ unfilteredJobs = concatLists (
map (
output:
workflowLib.mkMatrix (
@@ -94,6 +90,19 @@ in {
default = {};
};
+ exclude = mkOption {
+ description = mdDoc "outputs to exclude from matrix";
+ type = types.listOf types.str;
+ default = [];
+ example = literalExpression ''
+ {
+ githubWorkflowGenerator.exclude = [
+ "packages.x86_64-linux.foo"
+ ];
+ }
+ '';
+ };
+
overrides = mkOption {
description = mdDoc "overrides for mkMatrix args";
type = types.attrsOf (types.submodule overrides);
@@ -110,6 +119,6 @@ in {
};
config.flake.githubWorkflow = {
- matrix.include = jobs;
+ matrix.include = filter (job: !builtins.elem job.attr cfg.exclude) unfilteredJobs;
};
}