mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 09:49:48 +01:00
flake: add formatting check
This commit is contained in:
parent
69cd77630b
commit
cef3aefabb
1 changed files with 17 additions and 3 deletions
20
flake.nix
20
flake.nix
|
@ -13,8 +13,8 @@
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
specialArgs = {inherit lib;};
|
specialArgs = {inherit lib;};
|
||||||
} {
|
} {
|
||||||
# provide overridable systems
|
# Allow users to bring their own systems.
|
||||||
# https://github.com/nix-systems/nix-systems
|
# «https://github.com/nix-systems/nix-systems»
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
imports = [
|
imports = [
|
||||||
./flake/apps.nix
|
./flake/apps.nix
|
||||||
|
@ -62,7 +62,6 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
formatter = pkgs.alejandra;
|
|
||||||
devShells = {
|
devShells = {
|
||||||
default = self'.devShells.lsp;
|
default = self'.devShells.lsp;
|
||||||
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
nvim-nix = pkgs.mkShell {packages = [config.packages.nix];};
|
||||||
|
@ -70,6 +69,21 @@
|
||||||
packages = with pkgs; [nil statix deadnix alejandra];
|
packages = with pkgs; [nil statix deadnix alejandra];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Provide the default formatter. `nix fmt` in project root
|
||||||
|
# will format available files with the correct formatter.
|
||||||
|
# P.S: Please do not format with nixfmt! It messes with many
|
||||||
|
# syntax elements and results in unreadable code.
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
|
||||||
|
# Check if codebase is properly formatted.
|
||||||
|
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
|
||||||
|
# or with `nix flake check`
|
||||||
|
checks = {
|
||||||
|
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
|
||||||
|
alejandra --check ${self} < /dev/null | tee $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue