checks: Add formatting, statix and deadnix checks

This commit is contained in:
SebastianStork 2026-02-18 19:24:56 +01:00
parent 71132b3c94
commit 3ecc10c445
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
5 changed files with 95 additions and 10 deletions

20
flake-parts/checks.nix Normal file
View file

@ -0,0 +1,20 @@
{ inputs, self, ... }:
{
perSystem =
{ inputs', pkgs, ... }:
{
checks = {
formatting = (inputs.treefmt.lib.evalModule pkgs "${self}/treefmt.nix").config.build.check self;
statix = pkgs.runCommand "statix" { buildInputs = [ inputs'.statix.packages.statix ]; } ''
statix check ${self}
touch $out
'';
deadnix = pkgs.runCommand "deadnix" { buildInputs = [ pkgs.deadnix ]; } ''
deadnix --fail ${self}
touch $out
'';
};
};
}

View file

@ -1,16 +1,8 @@
{ inputs, ... }: { inputs, self, ... }:
{ {
perSystem = perSystem =
{ pkgs, ... }: { pkgs, ... }:
{ {
formatter = formatter = (inputs.treefmt.lib.evalModule pkgs "${self}/treefmt.nix").config.build.wrapper;
(inputs.treefmt.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
prettier.enable = true;
just.enable = true;
};
}).config.build.wrapper;
}; };
} }

60
flake.lock generated
View file

@ -114,6 +114,27 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"statix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1754487366,
"narHash": "sha256-pHYj8gUBapuUzKV/kN/tR3Zvqc7o6gdFB9XKXIp1SQ8=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "af66ad14b28a127c5c0f3bbb298218fc63528a18",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -284,6 +305,7 @@
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"radicale-birthday-calendar": "radicale-birthday-calendar", "radicale-birthday-calendar": "radicale-birthday-calendar",
"sops": "sops", "sops": "sops",
"statix": "statix",
"treefmt": "treefmt", "treefmt": "treefmt",
"vscode-extensions": "vscode-extensions" "vscode-extensions": "vscode-extensions"
} }
@ -308,6 +330,44 @@
"type": "github" "type": "github"
} }
}, },
"statix": {
"inputs": {
"flake-parts": "flake-parts_2",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
},
"locked": {
"lastModified": 1760596293,
"narHash": "sha256-duH6Il124g+CdYX+HCqOGnpJxyxOCgWYcrcK0CBnA2M=",
"owner": "oppiliappan",
"repo": "statix",
"rev": "e9df54ce918457f151d2e71993edeca1a7af0132",
"type": "github"
},
"original": {
"owner": "oppiliappan",
"repo": "statix",
"type": "github"
}
},
"systems": {
"flake": false,
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt": { "treefmt": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View file

@ -35,6 +35,11 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
statix = {
url = "github:oppiliappan/statix";
inputs.nixpkgs.follows = "nixpkgs";
};
vscode-extensions = { vscode-extensions = {
url = "github:nix-community/nix-vscode-extensions"; url = "github:nix-community/nix-vscode-extensions";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

8
treefmt.nix Normal file
View file

@ -0,0 +1,8 @@
{
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
prettier.enable = true;
just.enable = true;
};
}