fix(dotfiles): centralize fix app ignores
This commit is contained in:
@@ -3,9 +3,17 @@
|
||||
lib,
|
||||
formatter,
|
||||
system,
|
||||
ignore,
|
||||
}:
|
||||
let
|
||||
deadnixExcludeArgs = lib.concatStringsSep " " ([ "--exclude" ] ++ ignore.deadnix);
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
statixIgnoreArgs = lib.escapeShellArgs (
|
||||
lib.concatMap (path: [
|
||||
"--ignore"
|
||||
path
|
||||
]) ignore.statix
|
||||
);
|
||||
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
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -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};
|
||||
};
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
{ 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 = ignore.treefmt;
|
||||
|
||||
settings.formatter.nixfmt.excludes = ignore.nixfmt;
|
||||
}
|
||||
|
||||
22
src/dotfiles/ignore.nix
Normal file
22
src/dotfiles/ignore.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
let
|
||||
hardwareConfigurations = "configs/nixos/hosts/*/hardware-configuration.nix";
|
||||
thirdParty = "third_party";
|
||||
in
|
||||
{
|
||||
deadnix = [
|
||||
thirdParty
|
||||
hardwareConfigurations
|
||||
];
|
||||
|
||||
nixfmt = [
|
||||
hardwareConfigurations
|
||||
];
|
||||
|
||||
statix = [
|
||||
"${thirdParty}/**"
|
||||
];
|
||||
|
||||
treefmt = [
|
||||
"${thirdParty}/**"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user