Skip to content

Commit 2423af3

Browse files
committed
flake: fix formatting checks
Signed-off-by: NotAShelf <[email protected]> Change-Id: I2e79090e303930b060566aab02f7dd446a6a6964
1 parent 2d43bc3 commit 2423af3

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

flake.nix

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,29 @@
9191
# Check if codebase is properly formatted.
9292
# This can be initiated with `nix build .#checks.<system>.nix-fmt`
9393
# or with `nix flake check`
94-
nix-fmt = pkgs.runCommand "nix-fmt-check" {nativeBuildInputs = [pkgs.alejandra];} ''
95-
alejandra --check ${self} < /dev/null
96-
touch $out
97-
'';
94+
nix-fmt =
95+
pkgs.runCommand "nix-fmt-check"
96+
{
97+
src = self;
98+
nativeBuildInputs = [pkgs.alejandra pkgs.fd];
99+
} ''
100+
cd "$src"
101+
fd -t f -e nix -x alejandra --check '{}'
102+
touch $out
103+
'';
98104

99105
# Check if Markdown sources are properly formatted
100106
# This can be initiated with `nix build .#checks.<system>.md-fmt`
101107
# or with `nix flake check`
102-
md-fmt = pkgs.runCommand "md-fmt-check" {nativeBuildInputs = [pkgs.deno];} ''
103-
deno fmt --check ${self} --ext md
104-
touch $out
105-
'';
108+
md-fmt =
109+
pkgs.runCommand "md-fmt-check" {
110+
src = self;
111+
nativeBuildInputs = [pkgs.deno pkgs.fd];
112+
} ''
113+
cd "$src"
114+
fd -t f -e md -x deno fmt --check '{}'
115+
touch $out
116+
'';
106117
};
107118
};
108119
};

0 commit comments

Comments
 (0)