Skip to content

Commit 0fc6aaf

Browse files
authored
Merge pull request #1607 from rust-osdev/fix-fmt
xtask: fix nixfmt + update Nix flake + fix CI
2 parents d139871 + 98e6852 commit 0fc6aaf

File tree

7 files changed

+57
-43
lines changed

7 files changed

+57
-43
lines changed

.github/FUNDING.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# If you are a frequent contributor to uefi-rs and would like to be featured in
22
# the sponsors section, please contact the maintainers.
3-
43
github: phip1611

.github/workflows/developer_productivity.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Checkout sources
3535
uses: actions/checkout@v4
3636
- uses: Swatinem/rust-cache@v2
37-
- uses: cachix/install-nix-action@v30
37+
- uses: cachix/install-nix-action@v31
3838
# Dedicated step to separate all the
3939
# "copying path '/nix/store/...' from 'https://cache.nixos.org'."
4040
# messages from the actual build output.

.github/workflows/qa.yml

+32
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,35 @@ jobs:
88
- uses: actions/checkout@v4
99
# Executes "typos ."
1010
- uses: crate-ci/[email protected]
11+
lints:
12+
name: Lints
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout sources
16+
uses: actions/checkout@v4
17+
- uses: cachix/install-nix-action@v31
18+
- uses: Swatinem/rust-cache@v2
19+
# Dedicated step to separate all the
20+
# "copying path '/nix/store/...' from 'https://cache.nixos.org'."
21+
# messages from the actual build output.
22+
- name: Prepare Nix Store
23+
run: nix develop --command echo
24+
# A dedicated step removes spam from the actual job.
25+
- name: Build cargo xtask
26+
run: cargo xtask help >/dev/null
27+
# Executing this in a Nix shell ensures that all our checks run as all
28+
# required tooling exists.
29+
- name: Check formatting
30+
run: |
31+
CMD="cargo xtask fmt --check"
32+
nix develop --command bash -c "$CMD"
33+
- name: Run clippy
34+
run: |
35+
rustup component add clippy
36+
cargo xtask clippy --warnings-as-errors
37+
- name: Run cargo doc (without unstable)
38+
run: cargo xtask doc --warnings-as-errors --document-private-items
39+
- name: Verify generated code is up-to-date
40+
run: cargo xtask gen-code --check
41+
- name: Run additional checks on the uefi-raw package
42+
run: cargo xtask check-raw

.github/workflows/rust.yml

-27
Original file line numberDiff line numberDiff line change
@@ -81,33 +81,6 @@ jobs:
8181
- uses: Swatinem/rust-cache@v2
8282
- name: Run cargo test (without unstable)
8383
run: cargo xtask test
84-
lints:
85-
name: Lints
86-
runs-on: ubuntu-latest
87-
steps:
88-
- name: Checkout sources
89-
uses: actions/checkout@v4
90-
- uses: Swatinem/rust-cache@v2
91-
- name: Install yamlfmt
92-
env:
93-
YFV: "0.13.0"
94-
HASH: "043e96d754a8afa4f4c5c13ffb2f3e50c6be5a70bf53292d3025abc0b42fe4ae"
95-
run: |
96-
curl -L --fail --output /tmp/yamlfmt.tar.xz https://github.com/google/yamlfmt/releases/download/v${YFV}/yamlfmt_${YFV}_Linux_x86_64.tar.gz
97-
echo "${HASH} /tmp/yamlfmt.tar.xz" | sha256sum --check
98-
tar xf /tmp/yamlfmt.tar.xz -C /usr/local/bin yamlfmt
99-
- name: Check formatting
100-
run: cargo xtask fmt --check
101-
- name: Run clippy
102-
run: |
103-
rustup component add clippy
104-
cargo xtask clippy --warnings-as-errors
105-
- name: Run cargo doc (without unstable)
106-
run: cargo xtask doc --warnings-as-errors --document-private-items
107-
- name: Verify generated code is up-to-date
108-
run: cargo xtask gen-code --check
109-
- name: Run additional checks on the uefi-raw package
110-
run: cargo xtask check-raw
11184
# Run the build with our current stable MSRV (specified in
11285
# ./msrv_toolchain.toml). This serves to check that we don't
11386
# accidentally start relying on a new feature without intending

flake.lock

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

flake.nix

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
description = "uefi-rs";
33

44
inputs = {
5-
# We follow the latest stable release of nixpkgs
6-
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
5+
# Use freshest nixpkgs. We don't use master as packages in nixpkgs-unstable
6+
# have already been build by the nixpkgs CI and are available from the
7+
# nixos.org cache.
8+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
79
rust-overlay.url = "github:oxalica/rust-overlay";
810
};
911

xtask/src/main.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,23 @@ fn run_fmt_project(fmt_opt: &FmtOpt) -> Result<()> {
309309
eprintln!("Formatting: yml - SKIPPED");
310310
}
311311

312-
// fmt nix
313-
if has_cmd("nixfmt") {
312+
// fmt nix (by passing files as arguments)
313+
// `find . -name "*.nix" -type f -exec nix fmt {} \+`
314+
if has_cmd("find") && has_cmd("nixfmt") {
314315
eprintln!("Formatting: nix");
315-
let mut command = Command::new("nixfmt");
316+
let mut command = Command::new("find");
317+
command.arg(".");
318+
command.arg("-name");
319+
command.arg("*.nix");
320+
command.arg("-type");
321+
command.arg("f");
322+
command.arg("-exec");
323+
command.arg("nixfmt");
316324
if fmt_opt.check {
317325
command.arg("--check");
318326
}
319-
command.arg("nix");
320-
command.arg("shell.nix");
327+
command.arg("{}");
328+
command.arg("+");
321329

322330
match run_cmd(command) {
323331
Ok(_) => {

0 commit comments

Comments
 (0)