-
-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When enabled, automatically sets up packages and/or checks for all `nixvimConfigurations`
- Loading branch information
1 parent
8fb2fe2
commit e793c5c
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ lib, config, ... }: | ||
let | ||
cfg = config.nixvim; | ||
in | ||
{ | ||
options.nixvim = { | ||
packages = { | ||
enable = lib.mkEnableOption "automatically installing packages for each nixvimConfigurations"; | ||
nameFunction = lib.mkOption { | ||
type = lib.types.functionTo lib.types.str; | ||
description = '' | ||
A function to convert a nixvimConfiguration's name into a package name. | ||
**Type** | ||
``` | ||
String -> String | ||
``` | ||
''; | ||
default = name: "nixvim-" + name; | ||
defaultText = lib.literalExpression ''name: "nixvim-" + name''; | ||
example = lib.literalExpression ''name: name + "-nvim"''; | ||
}; | ||
}; | ||
checks = { | ||
enable = lib.mkEnableOption "automatically installing checks for each nixvimConfigurations"; | ||
nameFunction = lib.mkOption { | ||
type = lib.types.functionTo lib.types.str; | ||
description = '' | ||
A function to convert a nixvimConfiguration's name into a check name. | ||
**Type** | ||
``` | ||
String -> String | ||
``` | ||
''; | ||
default = name: "nixvim-" + name; | ||
defaultText = lib.literalExpression ''name: "nixvim-" + name''; | ||
example = lib.literalExpression ''name: "nixvim-" + name + "-test"''; | ||
}; | ||
}; | ||
}; | ||
config = { | ||
perSystem = | ||
{ config, ... }: | ||
{ | ||
packages = lib.mkIf cfg.packages.enable ( | ||
lib.mapAttrs' (name: configuration: { | ||
name = cfg.packages.nameFunction name; | ||
value = configuration.config.build.package; | ||
}) config.nixvimConfigurations | ||
); | ||
checks = lib.mkIf cfg.checks.enable ( | ||
lib.mapAttrs' (name: configuration: { | ||
name = cfg.checks.nameFunction name; | ||
value = configuration.config.build.test; | ||
}) config.nixvimConfigurations | ||
); | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters