Skip to content

Commit efd19a7

Browse files
committed
Update Nix formatter
1 parent d47072e commit efd19a7

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ jobs:
2121
with:
2222
fail-mode: true
2323
- name: Check Nix formatting
24-
run: nix develop -c check-nixpkgs-fmt
24+
run: nix develop -c check-nix-fmt
2525
- name: Check Rust formatting
26-
run: nix develop -c check-rustfmt
26+
run: nix develop -c check-rust-fmt
2727
- name: Clippy
2828
run: nix develop -c cargo clippy
2929

flake.nix

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@
8686
flake-checker = pkgs.naerskLib.buildPackage (
8787
{
8888
name = "flake-checker";
89-
src = self;
89+
src = builtins.path {
90+
name = "flake-checker-src";
91+
path = self;
92+
};
9093
doCheck = true;
9194
nativeBuildInputs = with pkgs; [ ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
9295
}
@@ -109,18 +112,18 @@
109112
{
110113
default =
111114
let
112-
check-nixpkgs-fmt = pkgs.writeShellApplication {
113-
name = "check-nixpkgs-fmt";
115+
check-nix-fmt = pkgs.writeShellApplication {
116+
name = "check-nix-fmt";
114117
runtimeInputs = with pkgs; [
115118
git
116-
nixpkgs-fmt
119+
nixfmt-rfc-style
117120
];
118121
text = ''
119-
nixpkgs-fmt --check "$(git ls-files '*.nix')"
122+
git ls-files '*.nix' | xargs nixfmt --check
120123
'';
121124
};
122-
check-rustfmt = pkgs.writeShellApplication {
123-
name = "check-rustfmt";
125+
check-rust-fmt = pkgs.writeShellApplication {
126+
name = "check-rust-fmt";
124127
runtimeInputs = with pkgs; [ rustToolchain ];
125128
text = "cargo fmt --check";
126129
};
@@ -158,16 +161,15 @@
158161
cargo-watch
159162
rust-analyzer
160163

161-
# Nix
162-
nixpkgs-fmt
163-
164164
# CI checks
165-
check-nixpkgs-fmt
166-
check-rustfmt
165+
check-nix-fmt
166+
check-rust-fmt
167167

168168
# Scripts
169169
get-ref-statuses
170170
update-readme
171+
172+
self.formatter.${system}
171173
];
172174

173175
env = {
@@ -177,5 +179,7 @@
177179
};
178180
}
179181
);
182+
183+
formatter = forAllSystems ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
180184
};
181185
}

0 commit comments

Comments
 (0)