lol

envoy: switch default WASM runtime to wasmtime (#435633)

authored by

Luke Granger-Brown and committed by
GitHub
b62edf00 507f4945

+35 -11
+16 -2
pkgs/by-name/en/envoy/bazel_nix.BUILD.bazel
··· 1 1 load("@bazel_tools//tools/sh:sh_toolchain.bzl", "sh_toolchain") 2 2 load("@rules_rust//rust:toolchain.bzl", "rust_toolchain") 3 + load("@rules_rust//rust:defs.bzl", "rust_stdlib_filegroup") 3 4 4 5 toolchains = { 5 6 "x86_64": "x86_64-unknown-linux-gnu", 6 7 "aarch64": "aarch64-unknown-linux-gnu", 7 8 } 8 9 9 - exports_files(["cargo", "rustdoc", "ruststd", "rustc"]) 10 + exports_files(["cargo", "rustdoc", "rustc"]) 11 + 12 + [ 13 + rust_stdlib_filegroup( 14 + name = "rust_nix_" + k + "_stdlib", 15 + srcs = glob( 16 + [ 17 + "rustcroot/lib/rustlib/" + v + "/lib/**", 18 + ], 19 + allow_empty=True, 20 + ), 21 + ) 22 + for k, v in toolchains.items() 23 + ] 10 24 11 25 [ 12 26 rust_toolchain( ··· 16 30 exec_triple = v, 17 31 cargo = ":cargo", 18 32 rust_doc = ":rustdoc", 19 - rust_std = ":ruststd", 33 + rust_std = ":rust_nix_" + k + "_stdlib", 20 34 rustc = ":rustc", 21 35 stdlib_linkflags = ["-ldl", "-lpthread"], 22 36 staticlib_ext = ".a",
+19 -9
pkgs/by-name/en/envoy/package.nix
··· 23 23 gnutar, 24 24 gnugrep, 25 25 envoy, 26 + git, 26 27 27 28 # v8 (upstream default), wavm, wamr, wasmtime, disabled 28 - wasmRuntime ? "wamr", 29 + wasmRuntime ? "wasmtime", 30 + 31 + # Allows overriding the deps hash used for building - you will likely need to 32 + # set this if you have changed the 'wasmRuntime' setting. 33 + depsHash ? null, 29 34 }: 30 35 31 36 let ··· 40 45 }; 41 46 42 47 # these need to be updated for any changes to fetchAttrs 43 - depsHash = 44 - { 45 - x86_64-linux = "sha256-E6yUSd00ngmjaMds+9UVZLtcYhzeS8F9eSIkC1mZSps="; 46 - aarch64-linux = "sha256-ivboOrV/uORKVHRL3685aopcElGvzsxgVcUmYsBwzXY="; 47 - } 48 - .${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 48 + depsHash' = 49 + if depsHash != null then 50 + depsHash 51 + else 52 + { 53 + x86_64-linux = "sha256-t4Xv4UGYW5YU0kmv+1rdf2JvM1BYQyNWdtpz6Cdmxm4="; 54 + aarch64-linux = "sha256-aIBnNGzc0hTdlTgRyJ7eLnWvHqZ5ywhqOM+mHfH3/18="; 55 + } 56 + .${stdenv.system} or (throw "unsupported system ${stdenv.system}"); 49 57 50 58 python3 = python312; 51 59 ··· 94 102 ln -sf "${cargo}/bin/cargo" bazel/nix/cargo 95 103 ln -sf "${rustc}/bin/rustc" bazel/nix/rustc 96 104 ln -sf "${rustc}/bin/rustdoc" bazel/nix/rustdoc 97 - ln -sf "${rustPlatform.rustLibSrc}" bazel/nix/ruststd 105 + ln -sf "${rustc.unwrapped}" bazel/nix/rustcroot 98 106 substituteInPlace bazel/dependency_imports.bzl \ 99 107 --replace-fail 'crate_universe_dependencies()' 'crate_universe_dependencies(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc")' \ 100 108 --replace-fail 'crates_repository(' 'crates_repository(rust_toolchain_cargo_template="@@//bazel/nix:cargo", rust_toolchain_rustc_template="@@//bazel/nix:rustc",' ··· 120 128 ninja 121 129 patchelf 122 130 cacert 131 + git 123 132 ]; 124 133 125 134 buildInputs = [ linuxHeaders ]; 126 135 127 136 fetchAttrs = { 128 - sha256 = depsHash; 137 + sha256 = depsHash'; 129 138 env.CARGO_BAZEL_REPIN = true; 130 139 dontUseCmakeConfigure = true; 131 140 dontUseGnConfigure = true; ··· 239 248 "--linkopt=-Wl,-z,noexecstack" 240 249 "--config=gcc" 241 250 "--verbose_failures" 251 + "--incompatible_enable_cc_toolchain_resolution=true" 242 252 243 253 # Force use of system Java. 244 254 "--extra_toolchains=@local_jdk//:all"