aboutsummaryrefslogtreecommitdiff
path: root/root/nix/apps.nix
diff options
context:
space:
mode:
authorvkcku <[email protected]>2026-06-01 09:49:40 +0530
committervkcku <[email protected]>2026-06-01 09:49:40 +0530
commit1147495fdf984c9675475705d906e4594af2ae88 (patch)
tree4ca78b293ad163bfb6af7d91e2795bb8ce4e6f66 /root/nix/apps.nix
parentroot: rename app to checks (diff)
root: add app to run formatter/linter treewide
monorepo-revid: 0a6179feba588ca7e614d2c9791f0a7da1560a5f
Diffstat (limited to 'root/nix/apps.nix')
-rw-r--r--root/nix/apps.nix28
1 files changed, 27 insertions, 1 deletions
diff --git a/root/nix/apps.nix b/root/nix/apps.nix
index 7421234..e5d619e 100644
--- a/root/nix/apps.nix
+++ b/root/nix/apps.nix
@@ -1,6 +1,11 @@
{
perSystem =
- { pkgs, ... }:
+ {
+ config,
+ lib,
+ pkgs,
+ ...
+ }:
{
apps.checks = {
type = "app";
@@ -13,5 +18,26 @@
);
meta.description = "run all the nix checks in parallel";
};
+
+ apps.lint =
+ let
+ devshells = builtins.filter (n: n != "common") (builtins.attrNames config.devShells);
+ mkTreefmtCommand = name: "nix develop .#${name} --command treefmt";
+ quotedCommands = lib.strings.concatMapStringsSep " " (
+ n: lib.escapeShellArg (mkTreefmtCommand n)
+ ) devshells;
+ in
+ {
+ type = "app";
+ program = toString (
+ pkgs.writeShellScript "treefmt" ''
+ set -xeuo pipefail
+
+ ${pkgs.parallel}/bin/parallel -j5 -k ::: ${quotedCommands}
+ ''
+ );
+ meta.description = "run treefmt from all the projects in parallel";
+ };
+
};
}