feat: add pre-commit-hooks devShell and checks
This commit is contained in:
parent
29de646d06
commit
fb3758dbbb
1 changed files with 27 additions and 1 deletions
28
flake.nix
28
flake.nix
|
|
@ -20,11 +20,16 @@
|
||||||
url = "github:nlewo/comin";
|
url = "github:nlewo/comin";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pre-commit-hooks = {
|
||||||
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs@{
|
outputs = inputs@{
|
||||||
self, nixpkgs,
|
self, nixpkgs,
|
||||||
flake-utils, sops-nix, utils, comin,
|
flake-utils, sops-nix, utils, comin, pre-commit-hooks,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -33,6 +38,27 @@
|
||||||
utils.lib.mkFlake {
|
utils.lib.mkFlake {
|
||||||
inherit self inputs;
|
inherit self inputs;
|
||||||
|
|
||||||
|
outputsBuilder = channels: let
|
||||||
|
pkgs = channels.nixpkgs;
|
||||||
|
system = pkgs.system;
|
||||||
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
nixfmt-rfc-style.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
terraform-format.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
checks = {
|
||||||
|
inherit pre-commit-check;
|
||||||
|
};
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inherit (pre-commit-check) shellHook;
|
||||||
|
buildInputs = pre-commit-check.enabledPackages;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
hostDefaults = {
|
hostDefaults = {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue