refactor(nix): simplify style tool outputs

This commit is contained in:
2026-09-15 22:56:00 -04:00
parent 44cf655f76
commit a779bebdbb

View File

@@ -82,40 +82,30 @@
... ...
}@inputs: }@inputs:
let let
supportedSystems = [ "x86_64-linux" ]; system = "x86_64-linux";
forAllSystems = nixpkgs.lib.genAttrs supportedSystems; pkgs = nixpkgs.legacyPackages.${system};
pkgsFor = system: nixpkgs.legacyPackages.${system}; treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
treefmtEvalFor = system: treefmt-nix.lib.evalModule (pkgsFor system) ./treefmt.nix; nixStyleCheck = pkgs.writeShellApplication {
name = "nix-style-check";
runtimeInputs = [
treefmtEval.config.build.wrapper
pkgs.statix
pkgs.deadnix
];
text = ''
treefmt --fail-on-change
statix check .
deadnix --fail --no-lambda-pattern-names --no-underscore .
'';
};
in in
{ {
formatter = forAllSystems (system: (treefmtEvalFor system).config.build.wrapper); formatter.${system} = treefmtEval.config.build.wrapper;
apps = forAllSystems ( apps.${system}.nix-style-check = {
system: type = "app";
let program = "${nixStyleCheck}/bin/nix-style-check";
pkgs = pkgsFor system; };
treefmtEval = treefmtEvalFor system;
nixStyleCheck = pkgs.writeShellApplication {
name = "nix-style-check";
runtimeInputs = [
treefmtEval.config.build.wrapper
pkgs.statix
pkgs.deadnix
];
text = ''
treefmt --fail-on-change
statix check .
deadnix --fail --no-lambda-pattern-names --no-underscore .
'';
};
in
{
nix-style-check = {
type = "app";
program = "${nixStyleCheck}/bin/nix-style-check";
};
}
);
nixosConfigurations = (import ./src/dotfiles { nixosConfigurations = (import ./src/dotfiles {
inherit inputs self; inherit inputs self;