about summary refs log tree commit diff
path: root/ops/ci
diff options
context:
space:
mode:
Diffstat (limited to 'ops/ci')
-rw-r--r--ops/ci/shellcheck.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/ops/ci/shellcheck.nix b/ops/ci/shellcheck.nix
new file mode 100644
index 0000000..c862a87
--- /dev/null
+++ b/ops/ci/shellcheck.nix
@@ -0,0 +1,24 @@
+{ pkgs, ... }: rec {
+  mkShellCheckScript = src:
+    let
+      script = pkgs.writeScript "shellcheck" ''
+        EXIT_STATUS=0
+        while IFS= read -r -d ''' i
+        do
+          if ${pkgs.shellcheck}/bin/shellcheck -x "$i"
+          then
+            echo "$i [ PASSED ]"
+          else
+            echo "$i [ FAILED ]"
+            EXIT_STATUS=$(($EXIT_STATUS+1))
+          fi
+        done <  <(find -name '*.sh' -print0)
+        echo Total Failed Files: $EXIT_STATUS
+        exit "$EXIT_STATUS"
+      '';
+    in
+    {
+      type = "app";
+      program = "${script}";
+    };
+}