···1{ stdenv
2, lib
03, fetchurl
4, fetchFromGitHub
5, rust
···7, installShellFiles
8, Security
9, CoreServices
010}:
1112rustPlatform.buildRustPackage rec {
···29 # The rusty_v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
30 # To avoid this we pre-download the file and place it in the locations it will require it in advance
31 preBuild =
32- let
33- inherit (import ./deps.nix { }) librusty_v8;
34- arch = rust.toRustTarget stdenv.hostPlatform;
35- librusty_v8_release = fetchurl {
36- url = "https://github.com/denoland/rusty_v8/releases/download/v${librusty_v8.version}/librusty_v8_release_${arch}.a";
37- sha256 = librusty_v8.sha256s.${stdenv.hostPlatform.system};
38- meta = { inherit (librusty_v8) version; };
39- };
40- in
41 ''
42- _rusty_v8_setup() {
43 for v in "$@"; do
44- dir="target/$v/gn_out/obj"
45- mkdir -p "$dir" && cp "${librusty_v8_release}" "$dir/librusty_v8.a"
46 done
47 }
4849 # Copy over the `librusty_v8.a` file inside target/XYZ/gn_out/obj, symlink not allowed
50- _rusty_v8_setup "debug" "release" "${arch}/release"
51 '';
5253 # Tests have some inconsistencies between runs with output integration tests
···1{ stdenv
2, lib
3+, callPackage
4, fetchurl
5, fetchFromGitHub
6, rust
···8, installShellFiles
9, Security
10, CoreServices
11+, librusty_v8 ? callPackage ./librusty_v8.nix { }
12}:
1314rustPlatform.buildRustPackage rec {
···31 # The rusty_v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
32 # To avoid this we pre-download the file and place it in the locations it will require it in advance
33 preBuild =
34+ let arch = rust.toRustTarget stdenv.hostPlatform; in
0000000035 ''
36+ _librusty_v8_setup() {
37 for v in "$@"; do
38+ install -D ${librusty_v8} "target/$v/gn_out/obj/librusty_v8.a"
039 done
40 }
4142 # Copy over the `librusty_v8.a` file inside target/XYZ/gn_out/obj, symlink not allowed
43+ _librusty_v8_setup "debug" "release" "${arch}/release"
44 '';
4546 # Tests have some inconsistencies between runs with output integration tests