nix-community.nixvim/flake-modules/dev/default.nix

72 lines
1.6 KiB
Nix
Raw Normal View History

{ lib, inputs, ... }:
2024-05-05 19:39:35 +02:00
{
imports =
[ ./devshell.nix ]
++ lib.optional (inputs.git-hooks ? flakeModule) inputs.git-hooks.flakeModule
++ lib.optional (inputs.treefmt-nix ? flakeModule) inputs.treefmt-nix.flakeModule;
2024-05-05 19:39:35 +02:00
perSystem =
{
lib,
pkgs,
config,
...
}:
let
fmt = pkgs.nixfmt-rfc-style;
in
lib.optionalAttrs (inputs.treefmt-nix ? flakeModule) {
treefmt.config = {
projectRootFile = "flake.nix";
flakeCheck = true;
programs = {
2024-08-23 19:39:13 -05:00
isort.enable = true;
nixfmt = {
enable = true;
package = fmt;
};
prettier = {
enable = true;
excludes = [ "**.md" ];
};
ruff = {
check = true;
format = true;
};
statix.enable = true;
2024-07-08 16:13:45 +01:00
stylua.enable = true;
shfmt.enable = true;
2024-07-08 16:40:17 +01:00
taplo.enable = true;
};
settings = {
global.excludes = [
".editorconfig"
".envrc"
".git-blame-ignore-revs"
".gitignore"
"LICENSE"
"flake.lock"
"**.md"
"**.scm"
"**.svg"
"**/man/*.5"
];
formatter.ruff-format.options = [ "--isolated" ];
};
};
}
// lib.optionalAttrs (inputs.git-hooks ? flakeModule) {
2024-05-05 19:39:35 +02:00
pre-commit = {
# We have a treefmt check already, so this is redundant.
check.enable = false;
2024-05-05 19:39:35 +02:00
settings.hooks = {
treefmt.enable = true;
2024-05-05 19:39:35 +02:00
typos.enable = true;
};
};
};
}