refactor(nix): simplify style tool outputs
This commit is contained in:
52
flake.nix
52
flake.nix
@@ -82,40 +82,30 @@
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
||||
treefmtEvalFor = system: treefmt-nix.lib.evalModule (pkgsFor system) ./treefmt.nix;
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs ./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
|
||||
{
|
||||
formatter = forAllSystems (system: (treefmtEvalFor system).config.build.wrapper);
|
||||
formatter.${system} = treefmtEval.config.build.wrapper;
|
||||
|
||||
apps = forAllSystems (
|
||||
system:
|
||||
let
|
||||
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";
|
||||
};
|
||||
}
|
||||
);
|
||||
apps.${system}.nix-style-check = {
|
||||
type = "app";
|
||||
program = "${nixStyleCheck}/bin/nix-style-check";
|
||||
};
|
||||
|
||||
nixosConfigurations = (import ./src/dotfiles {
|
||||
inherit inputs self;
|
||||
|
||||
Reference in New Issue
Block a user