-
Notifications
You must be signed in to change notification settings - Fork 947
Expand file tree
/
Copy pathlibrusty_v8.nix
More file actions
35 lines (35 loc) · 1.54 KB
/
librusty_v8.nix
File metadata and controls
35 lines (35 loc) · 1.54 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
# 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";
};
}