summaryrefslogtreecommitdiff
path: root/checks.nix
diff options
context:
space:
mode:
authorSeth Flynn <[email protected]>2025-03-05 15:27:26 -0500
committerSeth Flynn <[email protected]>2025-03-05 15:31:38 -0500
commit6fa4458f59160cdf9e82ad2138300b1041f510ad (patch)
tree88aeb808a13eadeacf0bc9b97d85c93f10de7a2d /checks.nix
parentb229a37e59b9720b7017e72a6d159b869ff36458 (diff)
treewide: use flake
Signed-off-by: Seth Flynn <[email protected]>
Diffstat (limited to 'checks.nix')
-rw-r--r--checks.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/checks.nix b/checks.nix
new file mode 100644
index 0000000..a21986a
--- /dev/null
+++ b/checks.nix
@@ -0,0 +1,51 @@
+{
+ lib,
+ inputs,
+ self,
+ ...
+}:
+
+let
+ collectNestedDerivationsIn = lib.foldlAttrs (
+ acc: attrType: values:
+
+ acc // lib.mapAttrs' (attrName: lib.nameValuePair "${attrType}-${attrName}") values
+ ) { };
+in
+
+{
+ imports = [ inputs.getchpkgs.flakeModules.checks ];
+
+ perSystem =
+ {
+ pkgs,
+ system,
+ self',
+ ...
+ }:
+
+ lib.mkMerge [
+ {
+ checks = collectNestedDerivationsIn { inherit (self') devShells packages; };
+ }
+
+ (lib.mkIf (system == "x86_64-linux") {
+ quickChecks = {
+ deadnix = {
+ dependencies = [ pkgs.deadnix ];
+ script = "deadnix --fail ${self}";
+ };
+
+ nixfmt = {
+ dependencies = [ pkgs.nixfmt-rfc-style ];
+ script = "nixfmt --check ${self}";
+ };
+
+ statix = {
+ dependencies = [ pkgs.statix ];
+ script = "statix check ${self}";
+ };
+ };
+ })
+ ];
+}