Skip to content

Commit 110c101

Browse files
committed
Move treefmt-nix wrapper to default.nix, expose as nix run --file . treefmt
1 parent b9dda96 commit 110c101

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Run type checker
3232
run: nix-shell --run "pyright pkgs/nixkube/src"
3333
- name: Check formatting
34-
run: nix-shell --run "treefmt --fail-on-change"
34+
run: nix run --file . treefmt -- --fail-on-change
3535
build-amd64:
3636
runs-on: ubuntu-latest
3737
steps:

default.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,18 @@ rec {
198198
};
199199
};
200200

201+
treefmt = inputs.treefmt-nix.lib.mkWrapper pkgs {
202+
projectRootFile = "flake.nix";
203+
programs.fish_indent.enable = true;
204+
programs.isort.enable = true;
205+
programs.nixfmt.enable = true;
206+
programs.ruff-check.enable = true;
207+
programs.ruff-format.enable = true;
208+
programs.shellcheck.enable = true;
209+
programs.typos.enable = true;
210+
programs.yamlfmt.enable = true;
211+
};
212+
201213
lixImage = pkgs.callPackage ./liximage.nix { };
202214
scratchImage = pkgs.callPackage ./scratchimage.nix { };
203215
}

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ lint:
5656

5757
# Check formatted code without changes
5858
check-fmt:
59-
direnv exec . treefmt --fail-on-change
59+
nix run --file . treefmt -- --fail-on-change
6060

6161
# Generate doc/options.md from kubenix module options
6262
gendoc:

shell.nix

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,7 @@ pkgs.mkShell {
3939
pkgs.ty
4040
pkgs.skopeo
4141
pkgs.stern
42-
(default.inputs.treefmt-nix.lib.mkWrapper pkgs {
43-
projectRootFile = "flake.nix";
44-
programs.fish_indent.enable = true;
45-
programs.isort.enable = true;
46-
programs.nixfmt.enable = true;
47-
programs.ruff-check.enable = true;
48-
programs.ruff-format.enable = true;
49-
programs.shellcheck.enable = true;
50-
programs.typos.enable = true;
51-
programs.yamlfmt.enable = true;
52-
})
42+
default.treefmt
5343
];
5444
shellHook = # bash
5545
''

0 commit comments

Comments
 (0)