From 1d1e122c971c7e01a7e01937dba20479cd022448 Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 11 Nov 2024 17:24:10 -0500 Subject: [PATCH] ci: add flake checks --- flake.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/flake.nix b/flake.nix index a307d3dc..a6c6cda9 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,29 @@ nixpkgsFor = nixpkgs.legacyPackages; in { + checks = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}; + mkCheck = + name: deps: script: + pkgs.runCommand name { nativeBuildInputs = deps; } '' + ${script} + touch $out + ''; + in + { + actionlint = mkCheck "check-actionlint" [ pkgs.actionlint ] "actionlint ${./.github/workflows}/*"; + deadnix = mkCheck "check-deadnix" [ pkgs.deadnix ] "deadnix --fail ${self}"; + statix = mkCheck "check-statix" [ pkgs.statix ] "statix check ${self}"; + nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] "nixfmt --check ${self}"; + rustfmt = mkCheck "check-rustfmt" [ + pkgs.cargo + pkgs.rustfmt + ] "cd ${self} && cargo fmt -- --check"; + } + ); + devShells = forAllSystems ( system: let