nix-community.nixvim/flake-modules/dev/default.nix
seth 432a513ccd
flake/dev: make git-hooks optional
as this isn't used by consumers, they should be able to remove this
input via `inputs.nixvim.inputs.git-hooks.follows = ""`. it is
especially important here as `git-hooks` has a large amount of inputs
itself
2024-07-07 16:05:04 -04:00

46 lines
939 B
Nix

{ lib, inputs, ... }:
{
imports = [
inputs.treefmt-nix.flakeModule
./devshell.nix
] ++ lib.optional (inputs.git-hooks ? flakeModule) inputs.git-hooks.flakeModule;
perSystem =
{
lib,
pkgs,
config,
...
}:
let
fmt = pkgs.nixfmt-rfc-style;
in
{
treefmt.config = {
projectRootFile = "flake.nix";
programs = {
nixfmt = {
enable = true;
package = fmt;
};
statix.enable = true;
};
};
}
// lib.optionalAttrs (inputs.git-hooks ? flakeModule) {
pre-commit = {
settings.hooks = {
nixfmt = {
enable = true;
package = fmt;
};
statix = {
enable = true;
excludes = [ "plugins/lsp/language-servers/rust-analyzer-config.nix" ];
};
typos.enable = true;
};
};
};
}