aboutsummaryrefslogtreecommitdiff
path: root/root/nix
diff options
context:
space:
mode:
authorvkcku <[email protected]>2026-06-01 08:35:46 +0530
committervkcku <[email protected]>2026-06-01 08:35:46 +0530
commitc94d7062dbbc5a7b446d358b73b7f53a7de96632 (patch)
tree20f1afc64e15bad61280c7893e8634aadf637d15 /root/nix
parentroot: add app to run nix checks in parallel (diff)
root: add nix checks
monorepo-revid: 0dc6923deca6e3944819a269bd100c56c9379031
Diffstat (limited to 'root/nix')
-rw-r--r--root/nix/checks.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/root/nix/checks.nix b/root/nix/checks.nix
new file mode 100644
index 0000000..9a0bc16
--- /dev/null
+++ b/root/nix/checks.nix
@@ -0,0 +1,57 @@
+{ inputs, self, ... }:
+{
+ perSystem =
+ {
+ lib,
+ pkgs,
+ system,
+ ...
+ }:
+ let
+ mkCheck =
+ prefix: key: value:
+ lib.attrsets.nameValuePair "${prefix}-${key}" value;
+ devshells = lib.attrsets.mapAttrs' (mkCheck "devshell") self.devShells."${system}";
+ packages = lib.attrsets.mapAttrs' (mkCheck "build") self.packages."${system}";
+
+ nixos =
+ let
+ isCurrentSystem = _: conf: conf.pkgs.stdenv.hostPlatform.system == system;
+ nixos = lib.attrsets.filterAttrs isCurrentSystem self.nixosConfigurations;
+ in
+ lib.attrsets.mapAttrs' (mkCheck "nixos") (
+ lib.attrsets.mapAttrs (_: conf: conf.config.system.build.toplevel) nixos
+ );
+ in
+ {
+ checks =
+ packages
+ // nixos
+ // devshells
+ // {
+ root-lint =
+ let
+ treefmt = pkgs.callPackage ./_treefmt.nix { treefmt-nix = inputs.treefmt-nix; };
+ in
+ pkgs.stdenvNoCC.mkDerivation {
+ name = "root-lint";
+ version = "0.0.1";
+
+ src = lib.fileset.toSource {
+ root = ../../.;
+ fileset = lib.fileset.unions [
+ ../../flake.lock
+ ../../flake.nix
+ ../../README.md
+ ../../root
+ ];
+ };
+
+ buildPhase = ''
+ "${treefmt}/bin/treefmt" --ci
+ touch "$out"
+ '';
+ };
+ };
+ };
+}