From 1147495fdf984c9675475705d906e4594af2ae88 Mon Sep 17 00:00:00 2001 From: vkcku Date: Mon, 1 Jun 2026 09:49:40 +0530 Subject: root: add app to run formatter/linter treewide monorepo-revid: 0a6179feba588ca7e614d2c9791f0a7da1560a5f --- root/nix/apps.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'root/nix') 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"; + }; + }; } -- cgit v1.3.1