summaryrefslogtreecommitdiff
path: root/dev/checks.nix
blob: 533c2a067d19523a620108b0ac2dcd2c3c66f2a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  perSystem =
    { lib, pkgs, ... }:
    let
      root = lib.fileset.toSource {
        root = ../.;
        fileset = lib.fileset.unions [
          ./.
          ../.github
          ../nixvim
          ../flake.nix
        ];
      };
    in
    {
      checks = {
        format-and-lint =
          pkgs.runCommand "format-and-lint"
            {
              src = root;
              nativeBuildInputs = [
                pkgs.actionlint
                pkgs.deadnix
                pkgs.nixfmt-rfc-style
                pkgs.statix
              ];
            }
            ''
              echo "running actionlint..."
              actionlint ./.github/workflows/*

              echo "running deadnix..."
              deadnix

              echo "running nixfmt..."
              nixfmt --check .

              echo "running statix..."
              statix check .

              touch $out
            '';
      };
    };
}