-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
589 lines (507 loc) · 22.8 KB
/
Copy pathflake.nix
File metadata and controls
589 lines (507 loc) · 22.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
{
description = "bijou: bijective variable-length integer encodings";
inputs = {
nixpkgs.url = "nixpkgs/nixos-26.05";
nixos-unstable.url = "nixpkgs/nixos-unstable-small";
flake-utils.url = "github:numtide/flake-utils";
command-utils = {
url = "git+https://codeberg.org/expede/nix-command-utils";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
wasm-bodge-src = {
# Tracks the upstream `main` branch. wasm-bodge moves quickly enough
# that being a release or two behind is genuinely costly (see e.g. the
# debug/slim and initSync({module}) fixes that landed post-v0.2.3).
url = "github:alexjg/wasm-bodge/main";
flake = false;
};
};
outputs = {
self,
flake-utils,
nixos-unstable,
nixpkgs,
rust-overlay,
command-utils,
wasm-bodge-src,
} @ inputs:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [
(import rust-overlay)
];
pkgs = import nixpkgs {
inherit system overlays;
config.allowUnfree = true;
};
unstable = import nixos-unstable {
inherit system overlays;
config.allowUnfree = true;
};
rustVersion = "1.90.0";
rust-toolchain = pkgs.rust-bin.stable.${rustVersion}.default.override {
extensions = [
"cargo"
"clippy"
"llvm-tools-preview"
"rust-src"
"rust-std"
];
targets = [
"aarch64-apple-darwin"
"x86_64-apple-darwin"
"x86_64-unknown-linux-musl"
"aarch64-unknown-linux-musl"
"wasm32-unknown-unknown"
"thumbv6m-none-eabi"
];
};
# Nightly rustfmt for unstable formatting options (imports_granularity, etc.)
# We need a combined nightly toolchain (rustc + rustfmt) because rustfmt
# links against librustc_driver, which lives in the rustc component.
# On macOS, symlinks break @rpath resolution, so we wrap the binary
# with DYLD_LIBRARY_PATH pointing to the combined toolchain's lib/.
nightly-rustfmt-unwrapped = pkgs.rust-bin.nightly.latest.minimal.override {
extensions = [ "rustfmt" ];
};
nightly-rustfmt = pkgs.writeShellScriptBin "rustfmt" ''
export DYLD_LIBRARY_PATH="${nightly-rustfmt-unwrapped}/lib''${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
export LD_LIBRARY_PATH="${nightly-rustfmt-unwrapped}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "${nightly-rustfmt-unwrapped}/bin/rustfmt" "$@"
'';
# Pinned-toolchain Rust platform for building helper crates from source.
# Reused by wasm-bodge and gungraun-runner; both need our edition-2024
# rust-overlay toolchain rather than the nixpkgs default.
pinnedRustPlatform = pkgs.makeRustPlatform {
cargo = rust-toolchain;
rustc = rust-toolchain;
};
wasm-bodge = pinnedRustPlatform.buildRustPackage {
pname = "wasm-bodge";
version = wasm-bodge-src.shortRev;
src = wasm-bodge-src;
cargoHash = "sha256-akp4r8C4MWGqTbqr40jHdHuzqx6ZKcr4rFynarPsZWI=";
nativeBuildInputs = [ unstable.cargo-auditable ];
doCheck = false; # tests require npm/puppeteer infrastructure
};
# gungraun-runner: required binary harness for gungraun (formerly
# iai-callgrind) instruction-count benchmarks. Not yet in nixpkgs;
# we build it from crates.io. Version must match the `gungraun`
# workspace dep in `bijou64/Cargo.toml`.
gungraun-runner = pinnedRustPlatform.buildRustPackage rec {
pname = "gungraun-runner";
version = "0.18.2";
src = pkgs.fetchCrate {
inherit pname version;
hash = "sha256-DiJq9TZCZdWKSstIyMjkLuxaYXua0WKD2AVbEIxM590=";
};
cargoHash = "sha256-eb9U1MgCg7MpwzS2RnFXMWdPitweKMMty0n3SC0F6+I=";
# Tests require a full benchmark execution loop with valgrind.
# We're shipping just the binary harness.
doCheck = false;
};
# wasm-bindgen-cli 0.2.118 (not yet in nixpkgs)
wasm-bindgen-cli_0_2_118 = unstable.buildWasmBindgenCli rec {
src = unstable.fetchCrate {
pname = "wasm-bindgen-cli";
version = "0.2.118";
hash = "sha256-ve783oYH0TGv8Z8lIPdGjItzeLDQLOT5uv/jbFOlZpI=";
};
cargoDeps = unstable.rustPlatform.fetchCargoVendor {
inherit src;
inherit (src) pname version;
hash = "sha256-EYDfuBlH3zmTxACBL+sjicRna84CvoesKSQVcYiG9P0=";
};
};
format-pkgs = with pkgs; [
alejandra
nixpkgs-fmt
taplo
];
cargo-installs = with pkgs; [
cargo-component
cargo-criterion
cargo-deny
cargo-expand
cargo-flamegraph
cargo-nextest
cargo-outdated
cargo-release
cargo-sort
cargo-udeps
cargo-watch
twiggy
wasm-bindgen-cli_0_2_118
wasm-tools
];
# `xdg-utils` lacks `meta.mainProgram`, which makes `getExe`
# (used by the command-utils modules below) emit a deprecation
# warning. Annotate it so `getExe` resolves `xdg-open` cleanly.
xdg-open = pkgs.xdg-utils // {
meta = (pkgs.xdg-utils.meta or { }) // { mainProgram = "xdg-open"; };
};
# Built-in command modules from nix-command-utils
rust = command-utils.rust.${system};
wasm = command-utils.wasm.${system};
cmd = command-utils.cmd.${system};
# Python environment for benchmark chart generation (analyze.py)
bench-charts-python = pkgs.python3.withPackages (ps: [
ps.matplotlib
ps.numpy
ps.pandas
ps.plotly
ps.seaborn
]);
bench-charts = pkgs.writeShellScriptBin "bench-charts" ''
exec "${bench-charts-python}/bin/python3" "$WORKSPACE_ROOT/bijou64/charts/analyze.py" "$@"
'';
size-charts = pkgs.writeShellScriptBin "size-charts" ''
exec "${bench-charts-python}/bin/python3" "$WORKSPACE_ROOT/bijou64/charts/size_charts.py" "$@"
'';
# Project-specific commands
projectCommands = {
"bench:shootout" = cmd "Run the bijou64 criterion shootout benchmark" ''
${pkgs.cargo}/bin/cargo bench --package bijou64 --bench shootout
'';
"bench:gungraun" = cmd "Run the bijou64 gungraun instruction-count benchmark" ''
${pkgs.cargo}/bin/cargo bench --package bijou64 --bench gungraun_shootout
'';
"bench:charts" = cmd "Generate benchmark comparison charts (requires bench results in target/criterion)" ''
${bench-charts}/bin/bench-charts "$@"
'';
"size:charts" = cmd "Generate encoded-size comparison charts (arch-independent, no benchmarks needed)" ''
${size-charts}/bin/size-charts "$@"
'';
"test:props" = cmd "Run property tests with 1M iterations" ''
set -e
echo "Running property tests with 1,000,000 iterations each..."
export BOLERO_RANDOM_ITERATIONS=1000000
${pkgs.cargo}/bin/cargo test --release --workspace --features bolero --lib tests::property -- --nocapture
echo ""
echo "✓ All property tests passed"
'';
"test:props:intense" = cmd "Run property tests with 100M iterations (~10 min)" ''
set -e
echo "Running property tests with 100,000,000 iterations each..."
export BOLERO_RANDOM_ITERATIONS=100000000
${pkgs.cargo}/bin/cargo test --release --workspace --features bolero --lib tests::property -- --nocapture
'';
"test:no_std" = cmd "Check no_std builds for bijou32, bijou64, and bijou128" ''
set -e
${pkgs.cargo}/bin/cargo check --package bijou32 --no-default-features -v
${pkgs.cargo}/bin/cargo check --package bijou64 --no-default-features -v
${pkgs.cargo}/bin/cargo check --package bijou128 --no-default-features -v
echo ""
echo "✓ no_std check passed"
'';
"check:wasm" = cmd "Check the workspace builds for wasm32-unknown-unknown" ''
set -e
${pkgs.cargo}/bin/cargo check --workspace --target wasm32-unknown-unknown
echo ""
echo "✓ wasm32 check passed"
'';
"bodge:all" = cmd "Build all bijou wasm packages with wasm-bodge (release + /debug variants)" ''
set -e
for crate in bijou32_wasm bijou64_wasm bijou128_wasm; do
echo "===> wasm-bodge build $crate..."
${pkgs.coreutils}/bin/rm -rf "$WORKSPACE_ROOT/$crate/dist"
${wasm-bodge}/bin/wasm-bodge build \
--crate-path "$WORKSPACE_ROOT/$crate" \
--package-json "$WORKSPACE_ROOT/$crate/package.json" \
--out-dir "$WORKSPACE_ROOT/$crate/dist" \
--debug-profile wasm-debug
done
echo ""
echo "✓ All bijou wasm packages built with wasm-bodge"
"wasm:sizes"
'';
"bodge" = cmd "Build bijou64_wasm into a universal NPM package via wasm-bodge" ''
set -e
${pkgs.coreutils}/bin/rm -rf "$WORKSPACE_ROOT/bijou64_wasm/dist"
echo "===> wasm-bodge build bijou64_wasm..."
${wasm-bodge}/bin/wasm-bodge build \
--crate-path "$WORKSPACE_ROOT/bijou64_wasm" \
--package-json "$WORKSPACE_ROOT/bijou64_wasm/package.json" \
--out-dir "$WORKSPACE_ROOT/bijou64_wasm/dist" \
--debug-profile wasm-debug
echo ""
echo "✓ bijou64_wasm built — output in bijou64_wasm/dist/"
'';
"bodge:32" = cmd "Build bijou32_wasm into a universal NPM package via wasm-bodge" ''
set -e
${pkgs.coreutils}/bin/rm -rf "$WORKSPACE_ROOT/bijou32_wasm/dist"
echo "===> wasm-bodge build bijou32_wasm..."
${wasm-bodge}/bin/wasm-bodge build \
--crate-path "$WORKSPACE_ROOT/bijou32_wasm" \
--package-json "$WORKSPACE_ROOT/bijou32_wasm/package.json" \
--out-dir "$WORKSPACE_ROOT/bijou32_wasm/dist" \
--debug-profile wasm-debug
echo ""
echo "✓ bijou32_wasm built — output in bijou32_wasm/dist/"
'';
"bodge:128" = cmd "Build bijou128_wasm into a universal NPM package via wasm-bodge" ''
set -e
${pkgs.coreutils}/bin/rm -rf "$WORKSPACE_ROOT/bijou128_wasm/dist"
echo "===> wasm-bodge build bijou128_wasm..."
${wasm-bodge}/bin/wasm-bodge build \
--crate-path "$WORKSPACE_ROOT/bijou128_wasm" \
--package-json "$WORKSPACE_ROOT/bijou128_wasm/package.json" \
--out-dir "$WORKSPACE_ROOT/bijou128_wasm/dist" \
--debug-profile wasm-debug
echo ""
echo "✓ bijou128_wasm built — output in bijou128_wasm/dist/"
'';
"wasm:sizes" = cmd "Print wasm bundle sizes for all bijou wasm packages" ''
set -e
format_size() {
local size=$1
if [ "$size" -gt 1048576 ]; then
echo "$(echo "scale=2; $size / 1048576" | ${pkgs.bc}/bin/bc) MB"
elif [ "$size" -gt 1024 ]; then
echo "$(echo "scale=2; $size / 1024" | ${pkgs.bc}/bin/bc) KB"
else
echo "$size B"
fi
}
rows=""
for dir in bijou32_wasm bijou64_wasm bijou128_wasm; do
wasm_file=$(ls "$WORKSPACE_ROOT/$dir/dist/wasm_bindgen/web/"*_bg.wasm 2>/dev/null | head -1)
if [ -n "$wasm_file" ] && [ -f "$wasm_file" ]; then
name=$(basename "$dir")
raw_size=$(${pkgs.coreutils}/bin/stat -c%s "$wasm_file" 2>/dev/null || echo "0")
gzip_size=$(${pkgs.gzip}/bin/gzip -c "$wasm_file" | ${pkgs.coreutils}/bin/wc -c)
raw_fmt=$(format_size "$raw_size")
gz_fmt=$(format_size "$gzip_size")
rows="$rows$name|$raw_fmt|$gz_fmt\n"
fi
done
echo ""
echo "┌───────────────────────────────────┬────────────┬────────────┐"
echo "│ Package │ Raw │ Gzipped │"
echo "├───────────────────────────────────┼────────────┼────────────┤"
printf "$rows" | while IFS='|' read -r name raw gz; do
printf "│ %-33s │ %10s │ %10s │\n" "$name" "$raw" "$gz"
done
echo "└───────────────────────────────────┴────────────┴────────────┘"
echo ""
'';
"test:js" = cmd "Run bijou64_wasm JS-package tests in Node + browsers (rebuilds dist via bodge)" ''
set -e
"test:js:node"
"test:js:browser"
'';
"test:js:node" = cmd "Run bijou64_wasm JS-package tests in Node.js via Mocha (rebuilds dist via bodge)" ''
set -e
bodge
cd "$WORKSPACE_ROOT/bijou64_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm run test:js:node
'';
"test:js:browser" = cmd "Run bijou64_wasm JS-package Playwright tests across browsers (rebuilds dist via bodge)" ''
set -e
bodge
cd "$WORKSPACE_ROOT/bijou64_wasm"
# `--frozen-lockfile` mirrors what CI does and makes sure the
# local run cannot silently mutate `pnpm-lock.yaml` if it
# disagrees with `package.json`. To intentionally update the
# lockfile, run `pnpm install` directly (without this wrapper).
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright test
'';
"test:js:browser:report" = cmd "Open the most recent Playwright HTML report" ''
cd "$WORKSPACE_ROOT/bijou64_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright show-report
'';
"test:js:32" = cmd "Run bijou32_wasm JS-package tests in Node + browsers (rebuilds dist via bodge:32)" ''
set -e
"test:js:32:node"
"test:js:32:browser"
'';
"test:js:32:node" = cmd "Run bijou32_wasm JS-package tests in Node.js via Mocha (rebuilds dist via bodge:32)" ''
set -e
"bodge:32"
cd "$WORKSPACE_ROOT/bijou32_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm run test:js:node
'';
"test:js:32:browser" = cmd "Run bijou32_wasm JS-package Playwright tests across browsers (rebuilds dist via bodge:32)" ''
set -e
"bodge:32"
cd "$WORKSPACE_ROOT/bijou32_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright test
'';
"test:js:32:browser:report" = cmd "Open the most recent bijou32_wasm Playwright HTML report" ''
cd "$WORKSPACE_ROOT/bijou32_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright show-report
'';
"test:js:128" = cmd "Run bijou128_wasm JS-package tests in Node + browsers (rebuilds dist via bodge:128)" ''
set -e
"test:js:128:node"
"test:js:128:browser"
'';
"test:js:128:node" = cmd "Run bijou128_wasm JS-package tests in Node.js via Mocha (rebuilds dist via bodge:128)" ''
set -e
"bodge:128"
cd "$WORKSPACE_ROOT/bijou128_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm run test:js:node
'';
"test:js:128:browser" = cmd "Run bijou128_wasm JS-package Playwright tests across browsers (rebuilds dist via bodge:128)" ''
set -e
"bodge:128"
cd "$WORKSPACE_ROOT/bijou128_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright test
'';
"test:js:128:browser:report" = cmd "Open the most recent bijou128_wasm Playwright HTML report" ''
cd "$WORKSPACE_ROOT/bijou128_wasm"
if [ ! -d node_modules ]; then
${pkgs.pnpm}/bin/pnpm install --frozen-lockfile
fi
${pkgs.pnpm}/bin/pnpm exec playwright show-report
'';
"ci" = cmd "Run full CI suite (fmt, clippy, test, no_std, wasm32, wasm-pack, JS package)" ''
set -e
echo "===> [1/7] Checking formatting..."
${pkgs.cargo}/bin/cargo fmt --check
echo "✓ Formatting OK"
echo ""
echo "===> [2/7] Running Clippy..."
${pkgs.cargo}/bin/cargo clippy --workspace --all-targets --all-features -- -D warnings
echo "✓ Clippy OK"
echo ""
echo "===> [3/7] Running host tests..."
${pkgs.cargo}/bin/cargo test --workspace --all-features
echo "✓ Host tests OK"
echo ""
echo "===> [4/7] Checking no_std..."
${pkgs.cargo}/bin/cargo check --package bijou32 --no-default-features
${pkgs.cargo}/bin/cargo check --package bijou64 --no-default-features
${pkgs.cargo}/bin/cargo check --package bijou128 --no-default-features
echo "✓ no_std OK"
echo ""
echo "===> [5/7] Checking wasm32 build..."
${pkgs.cargo}/bin/cargo check --workspace --target wasm32-unknown-unknown
echo "✓ wasm32 OK"
echo ""
echo "===> [6/7] Running wasm-pack tests in Node.js..."
${pkgs.wasm-pack}/bin/wasm-pack test --node bijou32_wasm
${pkgs.wasm-pack}/bin/wasm-pack test --node bijou64_wasm
${pkgs.wasm-pack}/bin/wasm-pack test --node bijou128_wasm
echo "✓ wasm-pack tests OK"
echo ""
echo "===> [7/7] Running JS-package tests (Node + browsers)..."
"test:js:32"
"test:js"
"test:js:128"
echo "✓ JS-package tests OK"
echo ""
echo "✓ All CI checks passed"
'';
};
command_menu = command-utils.commands.${system} [
# Rust commands
(rust.build { cargo = pkgs.cargo; })
(rust.test { cargo = pkgs.cargo; cargo-watch = pkgs.cargo-watch; })
(rust.lint { cargo = pkgs.cargo; })
(rust.fmt { cargo = pkgs.cargo; })
(rust.doc { cargo = pkgs.cargo; })
(rust.bench { cargo = pkgs.cargo; cargo-criterion = pkgs.cargo-criterion; inherit xdg-open; })
(rust.watch { cargo-watch = pkgs.cargo-watch; })
# Default wasm commands target the `bijou64_wasm` crate. They
# need to point at a `[package]`-manifest crate (the workspace
# root has only `[workspace]` and would make wasm-pack bail out
# with "missing field `package`"). The `bijou32_wasm` and
# `bijou128_wasm` crates have their own dedicated commands —
# see `bodge:32` / `bodge:128` and `test:js:32` / `test:js:128`
# in `projectCommands` below.
(wasm.build { wasm-pack = pkgs.wasm-pack; path = "bijou64_wasm"; })
(wasm.release { wasm-pack = pkgs.wasm-pack; gzip = pkgs.gzip; path = "bijou64_wasm"; })
(wasm.test { wasm-pack = pkgs.wasm-pack; path = "bijou64_wasm"; features = ""; })
(wasm.doc { cargo = pkgs.cargo; inherit xdg-open; })
{ commands = projectCommands; packages = []; }
];
in {
apps.bench-charts = {
type = "app";
program = "${bench-charts}/bin/bench-charts";
};
apps.size-charts = {
type = "app";
program = "${size-charts}/bin/size-charts";
};
packages = {
inherit gungraun-runner wasm-bodge;
};
devShells.default = pkgs.mkShell {
name = "bijou_shell";
nativeBuildInputs =
# `command_menu` is itself a list of derivations, so splice it
# in with `++` rather than nesting it as a single element
# (a nested list in `nativeBuildInputs` is deprecated).
command_menu
++ [
rust-toolchain
nightly-rustfmt
pkgs.binaryen
pkgs.esbuild # wasm-bodge spawns esbuild as a subprocess for bundling
pkgs.gnuplot
pkgs.http-server
pkgs.nodejs
pkgs.pnpm
pkgs.playwright-driver
pkgs.playwright-driver.browsers
pkgs.rust-analyzer
pkgs.valgrind # required by gungraun
pkgs.wasm-pack
gungraun-runner
wasm-bodge
]
++ format-pkgs
++ cargo-installs
++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.clang
pkgs.llvmPackages.libclang
pkgs.pkg-config
];
shellHook = ''
unset SOURCE_DATE_EPOCH
export WORKSPACE_ROOT="$(pwd)"
export RUSTFMT="${nightly-rustfmt}/bin/rustfmt"
# Point Playwright at Nix-provided browsers instead of letting
# it download its own (which fails on NixOS due to dynamic
# linking, and is wasteful elsewhere).
export PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}"
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
export PLAYWRIGHT_NODEJS_PATH="${pkgs.nodejs}/bin/node"
menu
'';
};
formatter = pkgs.alejandra;
}
);
}