aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--flake.lock23
-rw-r--r--flake.nix9
-rw-r--r--treefmt.nix5
3 files changed, 35 insertions, 2 deletions
diff --git a/flake.lock b/flake.lock
index fa90b36..b6f0f31 100644
--- a/flake.lock
+++ b/flake.lock
@@ -59,7 +59,8 @@
"inputs": {
"flake-utils": "flake-utils",
"home-manager": "home-manager",
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "treefmt-nix": "treefmt-nix"
}
},
"systems": {
@@ -76,6 +77,26 @@
"repo": "default",
"type": "github"
}
+ },
+ "treefmt-nix": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1743748085,
+ "narHash": "sha256-uhjnlaVTWo5iD3LXics1rp9gaKgDRQj6660+gbUU3cE=",
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "rev": "815e4121d6a5d504c0f96e5be2dd7f871e4fd99d",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "treefmt-nix",
+ "type": "github"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index 17260b1..54be09b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -14,6 +14,11 @@
flake-utils.url = "github:numtide/flake-utils";
+ treefmt-nix = {
+ url = "github:numtide/treefmt-nix";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
@@ -24,6 +29,7 @@
{
nixpkgs,
flake-utils,
+ treefmt-nix,
home-manager,
...
}:
@@ -31,9 +37,10 @@
system:
let
pkgs = import nixpkgs { inherit system; };
+ treefmt = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
- formatter = pkgs.nixfmt-rfc-style;
+ formatter = treefmt.config.build.wrapper;
}
)
// {
diff --git a/treefmt.nix b/treefmt.nix
new file mode 100644
index 0000000..972a362
--- /dev/null
+++ b/treefmt.nix
@@ -0,0 +1,5 @@
+{ pkgs, ... }:
+{
+ projectRootFile = "flake.nix";
+ programs.nixfmt.enable = true;
+}