chore(nix): add pre-commit checks
This commit is contained in:
parent
0f4436787c
commit
be8e419f66
3 changed files with 99 additions and 7 deletions
19
flake.nix
19
flake.nix
|
@ -5,6 +5,7 @@
|
|||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
mkElmDerivation.url = "github:jeslie0/mkElmDerivation";
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
@ -13,6 +14,7 @@
|
|||
nixpkgs,
|
||||
utils,
|
||||
mkElmDerivation,
|
||||
pre-commit-hooks,
|
||||
}:
|
||||
utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
|
@ -26,10 +28,13 @@
|
|||
devShells.default =
|
||||
with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [
|
||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||
|
||||
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages ++ [
|
||||
elmPackages.elm
|
||||
elmPackages.elm-test
|
||||
elmPackages.elm-format
|
||||
elmPackages.elm-review
|
||||
entr
|
||||
];
|
||||
};
|
||||
|
@ -50,6 +55,18 @@
|
|||
};
|
||||
};
|
||||
|
||||
checks = {
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
nixfmt-rfc-style.enable = true;
|
||||
elm-format.enable = true;
|
||||
# elm-review.enable = true;
|
||||
# elm-test.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue