Skip to content

Commit adc551a

Browse files
committed
ci: run bun.nix generator from autofix.ci
treefmt-nix excludes *.lock by default, so a bun.lock formatter never runs. Call generate-bun-nix directly in the autofix.ci job instead.
1 parent ec6fb19 commit adc551a

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

‎.github/workflows/autofix.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- uses: ./.github/actions/setup-nix-cache
2525
with:
2626
disk-job: preflight
27+
- name: Regenerate Bun derivations
28+
run: nix run .#generate-bun-nix
2729
- name: Apply formatting and lint fixes
2830
run: |
2931
nix fmt -- --no-cache

‎nix/treefmt.nix‎

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ in
8383
pkgs.coreutils
8484
];
8585
text = ''
86-
if [ "$#" -eq 0 ]; then
87-
set -- nix/tools/*/bun.lock
88-
fi
89-
for lockfile in "$@"; do
86+
for lockfile in nix/tools/*/bun.lock; do
9087
toolDir="$(dirname "$lockfile")"
9188
echo "Regenerating $toolDir"
9289
(cd "$toolDir" && bun2nix -o bun.nix)
@@ -125,7 +122,6 @@ in
125122
"rust/crates/ccusage-core/src/models-dev-pricing.json"
126123
"rust/crates/ccusage-core/src/models-dev-catalog-rules.json"
127124
"rust/adapters/codex/src/codex-auto-review-fallbacks.json"
128-
"nix/tools/*/bun.lock"
129125
];
130126

131127
# The tagpr PR template is a Go text/template, and oxfmt's markdown
@@ -134,10 +130,10 @@ in
134130
# `bun.lock`/`bun.nix` under nix/tools are regenerated verbatim by `bun
135131
# install` and `bun2nix`. Formatting them fights the generators: oxfmt
136132
# rewrites the JSONC lockfile, and deadnix strips the unused arguments
137-
# that bun.nix's `callPackage` signature requires. `bun.lock` stays
138-
# visible to the bun-nix formatter, which derives `bun.nix` from it.
133+
# that bun.nix's `callPackage` signature requires.
139134
settings.global.excludes = [
140135
".github/tagpr-template.md"
136+
"nix/tools/*/bun.lock"
141137
"nix/tools/*/bun.nix"
142138
];
143139

@@ -149,7 +145,6 @@ in
149145
command = lib.getExe pkgs.oxfmt;
150146
options = [ "--no-error-on-unmatched-pattern" ];
151147
includes = [ "*" ];
152-
excludes = [ "nix/tools/*/bun.lock" ];
153148
priority = 4;
154149
};
155150
actionlint = {
@@ -234,11 +229,6 @@ in
234229
];
235230
priority = 10;
236231
};
237-
bun-nix = {
238-
command = lib.getExe generateBunNix;
239-
includes = [ "nix/tools/*/bun.lock" ];
240-
priority = 11;
241-
};
242232
};
243233
};
244234

@@ -251,9 +241,9 @@ in
251241
program = lib.getExe schemaGen;
252242
};
253243
# `nix run .#generate-bun-nix` derives every committed bun.nix from its
254-
# sibling bun.lock. It is also the bun-nix treefmt formatter, so autofix.ci
255-
# commits the result on dependency PRs; contributors can use
256-
# `just gen-bun-nix` when a manifest also needs Bun to resolve a new lockfile.
244+
# sibling bun.lock. autofix.ci runs it on every pull request, while
245+
# contributors can use `just gen-bun-nix` when a manifest also needs Bun
246+
# to resolve a new lockfile.
257247
apps.generate-bun-nix = {
258248
type = "app";
259249
program = lib.getExe generateBunNix;

0 commit comments

Comments
 (0)