Skip to content

Commit

Permalink
ci(fix): treefmt-nix config with existing options
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobLichterfeld committed Sep 23, 2024
1 parent 2860bc3 commit 0f1ac9d
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
psql
mosquitto
mosquitto_sub
treefmt
]
++ optional stdenv.isLinux inotify-tools
++ optional stdenv.isDarwin terminal-notifier
Expand Down Expand Up @@ -206,11 +207,22 @@
}
];
}).config.result;
treefmt = import treefmt-nix { inherit pkgs; };
in
{
packages = {
devenv-up = devShell.config.procfileScript;
default = pkg;
};
devShells.default = devShell;

# Eval the treefmt modules
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = self.flake-root.projectRootFile;
package = pkgs.treefmt;
# for `nix fmt`
treefmt.config = {
flakeFormatter = true;
flakeCheck = true;
projectRootFile = "flake.nix";

# we really need to mirror the treefmt.toml as we can't use it directly
global.excludes = [
"*.gitignore"
"*.dockerignore"
Expand Down Expand Up @@ -258,21 +270,10 @@

programs.nixpkgs-fmt.enable = true;
};

in
{
packages = {
devenv-up = devShell.config.procfileScript;
default = pkg;
};
devShells.default = devShell;

# for `nix fmt`
formatter = treefmtEval.${pkgs.system}.config.build.wrapper;
# for `nix flake check`
checks = {
default = moduleTest;
formatting = treefmtEval.config.build.check self;
formatting = pkgs.treefmt.check;
};
}
))
Expand Down

0 comments on commit 0f1ac9d

Please sign in to comment.