Add flake checks

This commit is contained in:
SebastianStork 2024-07-16 22:59:49 +02:00
parent 2938191083
commit 584cd2101a
5 changed files with 40 additions and 9 deletions

26
flake/checks.nix Normal file
View file

@ -0,0 +1,26 @@
{ self, inputs, ... }:
{
perSystem =
{ pkgs, ... }:
{
checks = {
treefmt = (import ./treefmt.nix { inherit inputs pkgs; }).check self;
statix =
let
statix-config = pkgs.writeText "statix.toml" ''
disabled = ["repeated_keys"]
'';
in
pkgs.runCommand "statix" { buildInputs = [ pkgs.statix ]; } ''
statix check ${self} --config ${statix-config}
mkdir $out
'';
deadnix = pkgs.runCommand "deadnix" { buildInputs = [ pkgs.deadnix ]; } ''
deadnix ${self} --fail --exclude ${self}/flake/formatter.nix
mkdir $out
'';
};
};
}

View file

@ -3,14 +3,6 @@
perSystem =
{ pkgs, ... }:
{
formatter =
(inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
prettier.enable = true;
just.enable = true;
};
}).config.build.wrapper;
formatter = (import ./treefmt.nix { inherit inputs pkgs; }).wrapper;
};
}

9
flake/treefmt.nix Normal file
View file

@ -0,0 +1,9 @@
{ inputs, pkgs, ... }:
(inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
prettier.enable = true;
just.enable = true;
};
}).config.build