add format check

This commit is contained in:
DavHau 2023-05-29 10:20:56 +02:00
parent ef5c3a94b2
commit 27efbe76ba
2 changed files with 13 additions and 4 deletions

5
checks/is-formatted.nix Normal file
View File

@ -0,0 +1,5 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.runCommand "check-format" {} ''
${pkgs.alejandra}/bin/alejandra -c ${./.}
touch $out
''

View File

@ -46,7 +46,7 @@
name
(value
// {
imports = (value.imports or [] ++ [./format-module.nix]);
imports = value.imports or [] ++ [./format-module.nix];
})
)
customFormats;
@ -109,8 +109,13 @@
});
checks = forAllSystems (system: {
inherit (self.packages.${system})
nixos-generate;
inherit
(self.packages.${system})
nixos-generate
;
is-formatted = import ./checks/is-formatted.nix {
pkgs = nixpkgs.legacyPackages.${system};
};
});
devShells = forAllSystems (system: let
@ -136,7 +141,6 @@
default = nixos-generate;
});
# legacy flake schema compat
defaultApp = forAllSystems (system: self.apps."${system}".nixos-generate);
defaultPackage =