From 5b1dd85d2055d62bdbde105e2b061fb6be25fb45 Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 24 Dec 2023 04:46:29 -0500 Subject: flake: add checks --- checks.nix | 37 +++++++++++++++++++++++++++++++++++++ flake.nix | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 checks.nix diff --git a/checks.nix b/checks.nix new file mode 100644 index 0000000..93d387f --- /dev/null +++ b/checks.nix @@ -0,0 +1,37 @@ +self: { + lib, + runCommand, + system, + actionlint, + fd, + statix, + nil, + ... +}: let + formatter = self.formatter.${system}; +in { + check-actionlint = runCommand "check-actionlint" {} '' + ${lib.getExe actionlint} ${./.github/workflows}/* + + touch $out + ''; + + check-nil = runCommand "check-nil" {} '' + cd ${./.} + ${lib.getExe fd} . -e 'nix' | while read -r file; do + ${lib.getExe nil} diagnostics "$file" + done + + touch $out + ''; + + check-statix = runCommand "check-statix" {} '' + ${lib.getExe statix} check ${./.} + touch $out + ''; + + "check-${formatter.pname}" = runCommand "check-${formatter.pname}" {} '' + ${lib.getExe formatter} --check ${./.} + touch $out + ''; +} diff --git a/flake.nix b/flake.nix index 7ceda4d..e7eee65 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,8 @@ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys}); in { + checks = forAllSystems (import ./checks.nix self); + packages = forAllSystems ( { lib, -- cgit v1.2.3