diff --git a/flake.nix b/flake.nix index def67e21..29a7caa7 100644 --- a/flake.nix +++ b/flake.nix @@ -93,12 +93,18 @@ # odbc-sys links against a driver manager, and the C sources vendored by # aws-lc-sys, libsqlite3-sys and zstd-sys need a compiler. Nothing here - # reaches for OpenSSL: SQLPage speaks TLS through rustls. + # reaches for OpenSSL: SQLPage speaks TLS through rustls. build.rs embeds + # the browser assets, so every cargo gate builds them with npm first. cargoRuntime = pkgs: [ (rustToolchainFor pkgs) pkgs.stdenv.cc pkgs.unixodbc + pkgs.nodejs_26 ]; + buildBrowserAssets = '' + npm ci --ignore-scripts + npm run build + ''; # The database matrix runs prebuilt test binaries that link the unixODBC # driver manager statically. It still reads ODBCSYSINI at run time and # dlopens whatever absolute path this file names, so pointing that one @@ -157,6 +163,9 @@ env = cargoEnv pkgs; script = '' cargo fmt --all -- --check + '' + + buildBrowserAssets + + '' cargo clippy --all-targets --all-features -- -D warnings ''; }; @@ -165,18 +174,16 @@ description = "Run the Rust test suites against DATABASE_URL, or SQLite when it is unset"; packages = cargoRuntime pkgs; env = cargoEnv pkgs; - script = '' + script = buildBrowserAssets + '' cargo test "$@" ''; }; test-browser = { description = "Drive the components in a browser with Playwright"; - packages = [ pkgs.nodejs_26 ] ++ cargoRuntime pkgs; + packages = cargoRuntime pkgs; env = cargoEnv pkgs // playwrightEnv pkgs; - script = '' - npm ci --ignore-scripts - npm run build + script = buildBrowserAssets + '' cd tests/end-to-end npx playwright test "$@" ''; @@ -223,7 +230,6 @@ (with pkgs; [ biome hurl - nodejs_26 pkg-config sqlite ])