diff --git a/checks/is-formatted.nix b/checks/is-formatted.nix new file mode 100644 index 0000000..43d4e38 --- /dev/null +++ b/checks/is-formatted.nix @@ -0,0 +1,5 @@ +{pkgs ? import {}}: +pkgs.runCommand "check-format" {} '' + ${pkgs.alejandra}/bin/alejandra -c ${./.} + touch $out +'' diff --git a/flake.nix b/flake.nix index 7b2c8ed..2120b4d 100644 --- a/flake.nix +++ b/flake.nix @@ -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 =