nix-community.nixvim/flake-modules/dev/default.nix
traxys 7908729711 dev: Make the tests command able to select which test to launch
The `tests` command can either launch all tests (without any arguments),
a specific test with `-t/--test` or choose a test with `-i/--interactive`
2024-07-21 15:17:17 +02:00

65 lines
1.4 KiB
Nix

{ lib, inputs, ... }:
{
imports =
[ ./devshell.nix ]
++ lib.optional (inputs.git-hooks ? flakeModule) inputs.git-hooks.flakeModule
++ lib.optional (inputs.treefmt-nix ? flakeModule) inputs.treefmt-nix.flakeModule;
perSystem =
{
lib,
pkgs,
config,
...
}:
let
fmt = pkgs.nixfmt-rfc-style;
in
lib.optionalAttrs (inputs.treefmt-nix ? flakeModule) {
treefmt.config = {
projectRootFile = "flake.nix";
programs = {
nixfmt = {
enable = true;
package = fmt;
};
prettier = {
enable = true;
excludes = [ "**.md" ];
};
ruff = {
check = true;
format = true;
};
statix.enable = true;
stylua.enable = true;
shfmt.enable = true;
taplo.enable = true;
};
settings = {
global.excludes = [
".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) {
pre-commit = {
settings.hooks = {
treefmt.enable = true;
typos.enable = true;
};
};
};
}