diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 4f38855d..3efe267c 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -24,3 +24,5 @@ jobs: run: nix build -L .#typhon-webapp - name: Run API tests run: nix build -L .#checks.x86_64-linux.api + - name: Check formatting + run: nix build -L .#checks.x86_64-linux.formatted diff --git a/flake.nix b/flake.nix index abaed563..fc3257fc 100644 --- a/flake.nix +++ b/flake.nix @@ -55,6 +55,7 @@ api = pkgs.callPackage ./nix/check-api.nix { inherit typhon typhon-api-client-test; }; + formatted = pkgs.callPackage ./nix/check-formatted.nix {inherit rustToolchain;}; nixos = pkgs.callPackage ./nix/nixos/test.nix {typhon = self;}; }; diff --git a/nix/check-formatted.nix b/nix/check-formatted.nix new file mode 100644 index 00000000..637333a6 --- /dev/null +++ b/nix/check-formatted.nix @@ -0,0 +1,18 @@ +{ + alejandra, + rustToolchain, + stdenv, +}: +stdenv.mkDerivation { + name = "formatted"; + src = ../.; + nativeBuildInputs = [ + alejandra + rustToolchain + ]; + buildPhase = '' + alejandra -c . + cargo fmt --check + ''; + installPhase = "touch $out"; +}