Skip to content

Commit 2559f5f

Browse files
committed
build(nix): Introduce flake.formatter for nix fmt
1 parent 15499eb commit 2559f5f

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

flake.lock

+90
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
inputs = {
1919
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2020
flake-parts.url = "github:hercules-ci/flake-parts";
21+
nixfmt = {
22+
url = "github:piegamesde/nixfmt/rfc101-style";
23+
inputs.nixpkgs.follows = "nixpkgs";
24+
};
2125
};
2226

2327
# There's an optional binary cache available. The details are below, but they're commented out.
@@ -131,6 +135,11 @@
131135
...
132136
}:
133137
{
138+
# For standardised reproducible formatting with `nix fmt`
139+
# HELP: why does the per system formatter not work?
140+
# formatter = inputs.nixfmt.packages.${system}.nixfmt;
141+
formatter = if (system == "x86_64-linux") then inputs.nixfmt.packages.${system}.nixfmt else null;
142+
134143
# Unlike `.#packages`, legacyPackages may contain values of
135144
# arbitrary types (including nested attrsets) and may even throw
136145
# exceptions. This attribute isn't recursed into by `nix flake

0 commit comments

Comments
 (0)