summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <alyssa.ross@unikie.com>2022-11-15 11:27:28 +0000
committerAlyssa Ross <alyssa.ross@unikie.com>2022-11-18 16:44:08 +0000
commit6c0c95661b43075d8e66171d5ff4cd682aded8ca (patch)
treef198b898e2b737bd964d2d1f3c98a1a96898dc8c
parente2cdde0af4cebd13ceacf4ce7ce70e689bbe9dbc (diff)
downloadspectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar.gz
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar.bz2
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar.lz
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar.xz
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.tar.zst
spectrum-6c0c95661b43075d8e66171d5ff4cd682aded8ca.zip
nix/checks.nix: add rustfmt check
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
-rw-r--r--nix/checks.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nix/checks.nix b/nix/checks.nix
index 9ffdc0a..df21d69 100644
--- a/nix/checks.nix
+++ b/nix/checks.nix
@@ -6,6 +6,24 @@
 {
   recurseForDerivations = true;
 
+  rustfmt = config.pkgs.callPackage (
+    { lib, runCommand, rustfmt }:
+    runCommand "spectrum-rustfmt" {
+      src = lib.cleanSourceWith {
+        filter = path: type:
+          (builtins.baseNameOf path != "build" && type == "directory")
+          || builtins.match ''.*[^/]\.rs'' path != null;
+        src = lib.cleanSource ../.;
+      };
+
+      nativeBuildInputs = [ rustfmt ];
+    } ''
+      shopt -s globstar
+      rustfmt --check $src/**/*.rs
+      touch $out
+    ''
+  ) {};
+
   shellcheck = config.pkgs.callPackage (
     { lib, runCommand, shellcheck }:
     runCommand "spectrum-shellcheck" {