From b531d639c33983feec48fa1c3f6f0ebe4f0ef5a1 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 22 May 2024 01:38:12 -0400 Subject: flake: start using flake-checks --- checks.nix | 37 ------------------------------------- flake.lock | 16 ++++++++++++++++ flake.nix | 19 +++++++++++++++++-- 3 files changed, 33 insertions(+), 39 deletions(-) delete mode 100644 checks.nix diff --git a/checks.nix b/checks.nix deleted file mode 100644 index 93d387f..0000000 --- a/checks.nix +++ /dev/null @@ -1,37 +0,0 @@ -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.lock b/flake.lock index f6a630a..4a29fb4 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-checks": { + "locked": { + "lastModified": 1716193450, + "narHash": "sha256-wIbyIQRoLAfGe2v8W7LM6zEZ9Oy0jKuUX0HMUCLQJsM=", + "owner": "getchoo", + "repo": "flake-checks", + "rev": "842c3f225677aa55e44b94342f19c8f3e6f2be06", + "type": "github" + }, + "original": { + "owner": "getchoo", + "repo": "flake-checks", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1716312448, @@ -18,6 +33,7 @@ }, "root": { "inputs": { + "flake-checks": "flake-checks", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 0e3e12c..486dd4f 100644 --- a/flake.nix +++ b/flake.nix @@ -8,11 +8,13 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + # this can be removed with `inputs.flake-checks.follows = ""` + flake-checks.url = "github:getchoo/flake-checks"; }; outputs = { nixpkgs, - self, + flake-checks, ... }: let systems = [ @@ -24,7 +26,20 @@ forAllSystems = fn: nixpkgs.lib.genAttrs systems (sys: fn nixpkgs.legacyPackages.${sys}); in { - checks = forAllSystems (import ./checks.nix self); + checks = forAllSystems (pkgs: let + flake-checks' = flake-checks.lib.mkChecks { + root = ./.; + inherit pkgs; + }; + in { + inherit + (flake-checks') + actionlint + alejandra + deadnix + statix + ; + }); packages = forAllSystems ( { -- cgit v1.2.3