nix-community.nixvim/flake/dev/default.nix
Matt Sturgeon 6d10fc0c87
flake: partition dev dependencies
This removes the need for end-users to manually set
`nixvim.inputs.devshell.follows = ""` (etc)

We offload evaluation of some of our flake modules into a `dev`
partition submodule.
- When its not needed, this submodule is not evaluated.
- When it is needed, it fetches extra inputs from `flake/dev/flake.nix`
  as part of evaluating the submodule.

See https://flake.parts/options/flake-parts-partitions.html
2025-02-23 17:23:57 +00:00

115 lines
3.2 KiB
Nix

{ inputs, ... }:
{
imports = [
./devshell.nix
./list-plugins
./package-tests.nix
./template-tests.nix
./tests.nix
inputs.git-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
perSystem =
{
pkgs,
system,
...
}:
{
treefmt.config = {
projectRootFile = "flake.nix";
flakeCheck = true;
programs = {
isort.enable = true;
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
prettier = {
enable = true;
excludes = [ "**.md" ];
};
ruff = {
check = true;
format = true;
};
statix = {
enable = true;
disabled-lints = [
# We often use `nullable == true`
"bool_comparison"
];
};
stylua.enable = true;
shfmt.enable = true;
# FIXME: re-enable on darwin, currently broken: taplo with options '[format]' failed to apply: exit status 101
taplo.enable = pkgs.stdenv.isLinux;
};
settings = {
global.excludes = [
".editorconfig"
".envrc"
".git-blame-ignore-revs"
".gitignore"
"LICENSE"
"flake.lock"
"**.md"
"**.scm"
"**.svg"
"**/man/*.5"
# Those files are generated by pytest-regression, which then `diff`s them.
# Formatting them will make the tests fail.
"docs/gfm-alerts-to-admonitions/tests/**/*.yml"
];
formatter.ruff-format.options = [ "--isolated" ];
};
};
pre-commit = {
# We have a treefmt check already, so this is redundant.
# We also can't run the test if it includes running `nix build`,
# since the nix CLI can't build within a derivation builder.
check.enable = false;
settings.hooks = {
deadnix = {
enable = true;
settings = {
noLambdaArg = true;
noLambdaPatternNames = true;
edit = true;
};
};
treefmt.enable = true;
typos = {
enable = true;
excludes = [ "generated/*" ];
};
maintainers = {
enable = true;
name = "maintainers";
description = "Check maintainers when it is modified.";
files = "^lib/maintainers[.]nix$";
package = pkgs.nix;
entry = "nix build --no-link --print-build-logs";
args = [ ".#checks.${system}.maintainers" ];
pass_filenames = false;
};
plugins-by-name = {
enable = true;
name = "plugins-by-name";
description = "Check `plugins/by-name` when it's modified.";
files = "^(?:tests/test-sources/)?plugins/by-name/";
package = pkgs.nix;
entry = "nix build --no-link --print-build-logs";
args = [ ".#checks.${system}.plugins-by-name" ];
pass_filenames = false;
};
};
};
};
}