Skip to content

Commit 5c33e8a

Browse files
committed
nix: treefmt formatter
1 parent 7607154 commit 5c33e8a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
88
crane.url = "github:ipetkov/crane";
99
flake-utils.url = "github:numtide/flake-utils";
10+
treefmt.url = "github:numtide/treefmt-nix";
1011

1112
advisory-db = {
1213
url = "github:rustsec/advisory-db";
@@ -20,6 +21,7 @@
2021
nixpkgs,
2122
crane,
2223
flake-utils,
24+
treefmt,
2325
advisory-db,
2426
...
2527
}:
@@ -173,6 +175,8 @@
173175
nixfmt-rfc-style
174176
];
175177
};
178+
179+
formatter = (treefmt.lib.evalModule pkgs ./treefmt.nix).config.build.wrapper;
176180
}
177181
);
178182
# Sets substituters to avoid locally building something already built

treefmt.nix

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ pkgs, ... }:
2+
{
3+
projectRootFile = "flake.nix";
4+
5+
programs = {
6+
taplo.enable = true;
7+
rustfmt = {
8+
enable = true;
9+
edition = "2021";
10+
};
11+
nixfmt.enable = true;
12+
};
13+
}

0 commit comments

Comments
 (0)