nix: add pre-commit-hooks

This commit is contained in:
Bruno BELANYI 2021-05-31 22:01:28 +02:00
parent 140726a6ff
commit a57a6d38bd
2 changed files with 53 additions and 3 deletions

View file

@ -16,15 +16,38 @@
repo = "nixpkgs";
ref = "nixos-unstable";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
};
};
};
outputs = { self, futils, nixpkgs } @ inputs:
futils.lib.eachSystem futils.lib.allSystems (system:
outputs = { self, futils, nixpkgs, pre-commit-hooks } @ inputs:
futils.lib.eachDefaultSystem (system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
in
{
checks = {
pre-commit = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
nixpkgs-fmt = {
enable = true;
};
};
};
};
devShell = pkgs.mkShell {
name = "blog";
@ -32,6 +55,8 @@
gnumake
hugo
];
inherit (self.checks.${system}.pre-commit) shellHook;
};
}
);