add treefmt

This commit is contained in:
Jörg Thalheim 2024-11-17 18:24:20 +01:00
parent 53c853fb1a
commit 5d6bbabd23
2 changed files with 38 additions and 0 deletions

View file

@ -95,6 +95,10 @@
in
{
home-manager = self.legacyPackages.${system}.homeConfigurations.sops.activation-script;
treefmt =
(pkgs.callPackage ./formatter.nix {
inputs = privateInputs;
}).config.build.check;
}
// (suffix-stable packages-stable)
// nixpkgs.lib.optionalAttrs pkgs.stdenv.isLinux tests
@ -131,6 +135,13 @@
}
);
formatter = eachSystem (
{ pkgs, ... }:
(pkgs.callPackage ./formatter.nix {
inputs = privateInputs;
}).config.build.wrapper
);
apps = eachSystem (
{ pkgs, ... }:
{

27
formatter.nix Normal file
View file

@ -0,0 +1,27 @@
{ pkgs, inputs, ... }:
inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = ".git/config";
programs = {
nixfmt.enable = true;
deadnix.enable = true;
deno.enable = true;
};
settings = {
global.excludes = [
"./pkgs/sops-install-secrets/test-assets/*"
"*.narHash"
# unsupported extensions
"*.{asc,pub,gpg}"
"*/secrets.{bin,json,ini,yaml}"
];
formatter = {
deadnix = {
priority = 1;
};
};
};
}