diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-04-05 00:18:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-04-05 00:18:52 +0900 |
| commit | fea57b8e27a438fe8f2341b6cb21b73962b7504a (patch) | |
| tree | 87879cc3901f7bd6218b04a0001e0aad8bfa153f | |
| parent | 3a4e0333679ba6bc09e919eba0d15ca1cdb08461 (diff) | |
| download | dotfiles-fea57b8e27a438fe8f2341b6cb21b73962b7504a.tar.gz dotfiles-fea57b8e27a438fe8f2341b6cb21b73962b7504a.tar.zst dotfiles-fea57b8e27a438fe8f2341b6cb21b73962b7504a.zip | |
nix: introduce treefmt-nix "nix fmt"
| -rw-r--r-- | flake.lock | 23 | ||||
| -rw-r--r-- | flake.nix | 9 | ||||
| -rw-r--r-- | treefmt.nix | 5 |
3 files changed, 35 insertions, 2 deletions
@@ -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", @@ -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; +} |
