-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
52 lines (49 loc) · 1.43 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
inputs,
flake-parts-lib,
...
}: {
imports = [
inputs.flake-parts.flakeModules.flakeModules
inputs.git-hooks.flakeModule
./hooks/commitlint.nix
];
flake.flakeModules.integrations = {
options.perSystem = flake-parts-lib.mkPerSystemOption ({
self',
lib,
pkgs,
config,
...
}: let
inherit (lib) types mkOption;
inherit (import ./utils.nix {inherit pkgs lib;}) excludes;
cfg = config.snow-blower.integrations.git-hooks;
in {
options.snow-blower.integrations.git-hooks = lib.mkOption {
type = lib.types.submoduleWith {
modules = [
(inputs.git-hooks + "/modules/hooks.nix")
(inputs.git-hooks + "/modules/all-modules.nix")
{
rootSrc = self';
package = pkgs.pre-commit;
tools = import (inputs.git-hooks + "/nix/call-tools.nix") pkgs;
inherit excludes;
}
];
specialArgs = {inherit pkgs;};
shorthandOnlyDefinesConfig = true;
};
default = {};
description = "Integration of https://github.com/cachix/git-hooks.nix";
};
config.snow-blower = lib.mkIf ((lib.filterAttrs (_id: value: value.enable) cfg.hooks) != {}) {
packages = lib.mkAfter ([cfg.package] ++ (cfg.enabledPackages or []));
shell = {
startup = [cfg.installationScript];
};
};
});
};
}