From edf9fdd2b8ab99f559ee3bf870c883bb037ce3ea Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 16 Sep 2026 23:14:31 -0400 Subject: [PATCH] fix(dotfiles): centralize fix app ignores --- src/dotfiles/apps.nix | 12 ++++++++++-- src/dotfiles/default.nix | 5 ++++- src/dotfiles/formatter.nix | 10 ++++++---- src/dotfiles/ignore.nix | 4 ++++ 4 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 src/dotfiles/ignore.nix diff --git a/src/dotfiles/apps.nix b/src/dotfiles/apps.nix index a8c7e71..21368a1 100644 --- a/src/dotfiles/apps.nix +++ b/src/dotfiles/apps.nix @@ -3,9 +3,17 @@ lib, formatter, system, + ignore, }: let + deadnixExcludeArgs = lib.concatStringsSep " " ([ "--exclude" ] ++ ignore); pkgs = inputs.nixpkgs.legacyPackages.${system}; + statixIgnoreArgs = lib.escapeShellArgs ( + lib.concatMap (path: [ + "--ignore" + (if path == "third_party" then "${path}/**" else path) + ]) ignore + ); in { fix = { @@ -20,8 +28,8 @@ in ]; text = '' treefmt - statix fix . - deadnix --edit --exclude configs/nixos/hosts/*/hardware-configuration.nix -- . + statix fix ${statixIgnoreArgs} . + deadnix --edit ${deadnixExcludeArgs} -- . treefmt ''; } diff --git a/src/dotfiles/default.nix b/src/dotfiles/default.nix index d012438..5ade2a6 100644 --- a/src/dotfiles/default.nix +++ b/src/dotfiles/default.nix @@ -6,6 +6,8 @@ system, }: let + ignore = import ./ignore.nix; + util = import ./util.nix { inherit lib; }; registry = import ./registry.nix { @@ -43,7 +45,7 @@ in { formatter.${system} = (import ./formatter.nix { - inherit inputs system; + inherit inputs system ignore; }).config.build.wrapper; apps.${system} = import ./apps.nix { @@ -51,6 +53,7 @@ in inputs lib system + ignore ; formatter = self.formatter.${system}; }; diff --git a/src/dotfiles/formatter.nix b/src/dotfiles/formatter.nix index f4cf85d..87e45b8 100644 --- a/src/dotfiles/formatter.nix +++ b/src/dotfiles/formatter.nix @@ -1,10 +1,12 @@ -{ inputs, system }: +{ + inputs, + system, + ignore, +}: inputs.treefmt-nix.lib.evalModule inputs.nixpkgs.legacyPackages.${system} { projectRootFile = "flake.nix"; programs.nixfmt.enable = true; - settings.formatter.nixfmt.excludes = [ - "configs/nixos/hosts/*/hardware-configuration.nix" - ]; + settings.excludes = map (path: if path == "third_party" then "${path}/**" else path) ignore; } diff --git a/src/dotfiles/ignore.nix b/src/dotfiles/ignore.nix new file mode 100644 index 0000000..bb513c5 --- /dev/null +++ b/src/dotfiles/ignore.nix @@ -0,0 +1,4 @@ +[ + "third_party" + "configs/nixos/hosts/*/hardware-configuration.nix" +]