add formatter check

This commit is contained in:
Daylin Morgan 2025-01-13 14:41:21 -06:00
parent 5f3972d784
commit 4ccd0d9981
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -43,6 +43,23 @@ let
}) flakes }) flakes
); );
evalTreeFmt =
pkgs:
(treefmt-nix.lib.evalModule pkgs (
{ ... }:
{
projectRootFile = "flake.nix";
# don't warn me about missing formatters
settings.excludes = [
# likely to be nnl lockfiles
"pkgs/**/lock.json"
"hosts/**/secrets.yaml"
];
settings.on-unmatched = "debug";
programs = "prettier|nixfmt" |> listify |> enableAttrs;
}
));
oizysFlake = { oizysFlake = {
templates = { templates = {
dev = { dev = {
@ -84,25 +101,12 @@ let
inherit inputs lib self; inherit inputs lib self;
system = pkgs.system; system = pkgs.system;
} }
// {
formatter = (evalTreeFmt pkgs).config.build.check self;
}
); );
formatter = forAllSystems (pkgs: (evalTreeFmt pkgs).config.build.wrapper);
# formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); # formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
formatter = forAllSystems (
pkgs:
(treefmt-nix.lib.evalModule pkgs (
{ ... }:
{
projectRootFile = "flake.nix";
# don't warn me about missing formatters
settings.excludes = [
# likely to be nnl lockfiles
"pkgs/**/lock.json"
"hosts/**/secrets.yaml"
];
settings.on-unmatched = "debug";
programs = "prettier|nixfmt" |> listify |> enableAttrs;
}
)).config.build.wrapper
);
}; };
in in
{ {