Files
SpacetimeDB/librusty_v8.nix
T
Phoebe Goldman 9167f4b19b Update librusty_v8.nix for our new V8 dependency version. (#4202)
# Description of Changes

And more precisely pin the Cargo dep, along with a comment.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

1

# Testing

- [x] `nix build` now exits 0 and produces runnable binaries locally.
(`nix flake check` is still broken.)
2026-02-04 18:48:29 +00:00

36 lines
1.5 KiB
Nix

# Fetches a pre-built v8 build from GitHub.
#
# rusty_v8 is a bad citizen: it attempts to download a binary within its build.rs.
# When running in the Nix sandbox, this download fails, so the crate cannot build.
# We instead download the archive ahead of time using a Nix-friendly fetcher function,
# and in our flake.nix we'll reference it in an appropriate env var so the crate build finds it.
#
# From https://github.com/msfjarvis/crane_rusty_v8/blob/4e076af4edb396d9d9398013d4393ec8da49c841/librusty_v8.nix
# modified for our desired version
{
rust,
stdenv,
fetchurl,
}: let
arch = rust.toRustTarget stdenv.hostPlatform;
fetch_librusty_v8 = args:
fetchurl {
name = "librusty_v8-${args.version}";
url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a.gz";
sha256 = args.shas.${stdenv.hostPlatform.system};
meta = {inherit (args) version;};
};
in
fetch_librusty_v8 {
version = "145.0.0";
shas = {
x86_64-linux = "sha256-chV1PAx40UH3Ute5k3lLrgfhih39Rm3KqE+mTna6ysE=";
# I (pgoldman 2025-10-17) only use x86_64-linux, so I haven't filled in these hashes.
# If you use one of these platforms, run the build and wait for it to fail,
# copy the detected sha256 from the error message in here, then re-run.
aarch64-linux = "0000000000000000000000000000000000000000000000000000";
x86_64-darwin = "0000000000000000000000000000000000000000000000000000";
aarch64-darwin = "0000000000000000000000000000000000000000000000000000";
};
}