aboutsummaryrefslogtreecommitdiffhomepage
path: root/flake.nix
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-16 20:54:28 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-16 20:54:28 +0900
commit4d3bd5338fe9e959a5861f740bd92a34b355feb3 (patch)
tree324458d6ffc07557431a4d06f83059b338a5253d /flake.nix
parent138666d75301032710f7fb91c940a64c61d6ed7e (diff)
nix: implement flake checks
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix48
1 files changed, 47 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index 52757a15..7418c97e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -20,6 +20,52 @@
{
nixosModules.fortify = import ./nixos.nix;
+ checks = forAllSystems (
+ system:
+ let
+ pkgs = nixpkgsFor.${system};
+
+ inherit (pkgs)
+ runCommandLocal
+ nixfmt-rfc-style
+ deadnix
+ statix
+ ;
+ in
+ {
+ check-formatting =
+ runCommandLocal "check-formatting" { nativeBuildInputs = [ nixfmt-rfc-style ]; }
+ ''
+ cd ${./.}
+
+ echo "running nixfmt..."
+ nixfmt --check .
+
+ touch $out
+ '';
+
+ check-lint =
+ runCommandLocal "check-lint"
+ {
+ nativeBuildInputs = [
+ deadnix
+ statix
+ ];
+ }
+ ''
+ cd ${./.}
+
+ echo "running deadnix..."
+ deadnix --fail
+
+ echo "running statix..."
+ statix check .
+
+ touch $out
+ '';
+ }
+ );
+
packages = forAllSystems (
system:
let
@@ -56,7 +102,7 @@
};
modules = [ ./options.nix ];
};
- cleanEval = lib.filterAttrsRecursive (n: v: n != "_module") eval;
+ cleanEval = lib.filterAttrsRecursive (n: _: n != "_module") eval;
in
pkgs.nixosOptionsDoc { inherit (cleanEval) options; };
docText = pkgs.runCommand "fortify-module-docs.md" { } ''