Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
120 lines
3.5 KiB
Nix
120 lines
3.5 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
buildPackages,
|
|
cmake,
|
|
installShellFiles,
|
|
versionCheckHook,
|
|
nix-update-script,
|
|
enableShared ? !stdenv.hostPlatform.isStatic,
|
|
enableStatic ? stdenv.hostPlatform.isStatic,
|
|
}:
|
|
rustPlatform.buildRustPackage (finalAttrs: {
|
|
pname = "wasmtime";
|
|
version = "37.0.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "bytecodealliance";
|
|
repo = "wasmtime";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-OQyGcxWMOxxzBHyOg2LUVsFuBEow6NIJCfrnsYWZtzk=";
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
# Disable cargo-auditable until https://github.com/rust-secure-code/cargo-auditable/issues/124 is solved.
|
|
auditable = false;
|
|
|
|
cargoHash = "sha256-PXvhwnfGvGF4D6U+2dKp3wg6cbk/i+0bWRAMSkyd6i8=";
|
|
cargoBuildFlags = [
|
|
"--package"
|
|
"wasmtime-cli"
|
|
"--package"
|
|
"wasmtime-c-api"
|
|
];
|
|
|
|
outputs = [
|
|
"out"
|
|
"dev"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
installShellFiles
|
|
];
|
|
|
|
doCheck =
|
|
with stdenv.buildPlatform;
|
|
# SIMD tests are only executed on platforms that support all
|
|
# required processor features (e.g. SSE3, SSSE3 and SSE4.1 on x86_64):
|
|
# https://github.com/bytecodealliance/wasmtime/blob/v9.0.0/cranelift/codegen/src/isa/x64/mod.rs#L220
|
|
(isx86_64 -> sse3Support && ssse3Support && sse4_1Support)
|
|
&&
|
|
# The dependency `wasi-preview1-component-adapter` fails to build because of:
|
|
# error: linker `rust-lld` not found
|
|
!isAarch64;
|
|
|
|
# prevent $out from being propagated to $dev:
|
|
# the library and header files are not dependent on the binaries
|
|
propagatedBuildOutputs = [ ];
|
|
|
|
postInstall =
|
|
let
|
|
inherit (stdenv.hostPlatform.rust) cargoShortTarget;
|
|
in
|
|
''
|
|
moveToOutput lib $dev
|
|
${lib.optionalString (!enableShared) "rm -f $dev/lib/*.so{,.*}"}
|
|
${lib.optionalString (!enableStatic) "rm -f $dev/lib/*.a"}
|
|
|
|
# copy the build.rs generated c-api headers
|
|
# https://github.com/rust-lang/cargo/issues/9661
|
|
cp -r target/${cargoShortTarget}/release/build/wasmtime-c-api-impl-*/out/include $dev/include
|
|
''
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
install_name_tool -id \
|
|
$dev/lib/libwasmtime.dylib \
|
|
$dev/lib/libwasmtime.dylib
|
|
''
|
|
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd wasmtime \
|
|
--bash <("$out/bin/wasmtime" completion bash) \
|
|
--zsh <("$out/bin/wasmtime" completion zsh) \
|
|
--fish <("$out/bin/wasmtime" completion fish)
|
|
''
|
|
+ lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd wasmtime \
|
|
--bash "${buildPackages.wasmtime}"/share/bash-completion/completions/*.bash \
|
|
--zsh "${buildPackages.wasmtime}"/share/zsh/site-functions/* \
|
|
--fish "${buildPackages.wasmtime}"/share/fish/*/*
|
|
'';
|
|
|
|
nativeInstallCheckInputs = [
|
|
versionCheckHook
|
|
];
|
|
versionCheckProgramArg = "--version";
|
|
doInstallCheck = true;
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = {
|
|
description = "Standalone JIT-style runtime for WebAssembly, using Cranelift";
|
|
homepage = "https://wasmtime.dev/";
|
|
license = [
|
|
lib.licenses.asl20
|
|
lib.licenses.llvm-exception
|
|
];
|
|
mainProgram = "wasmtime";
|
|
maintainers = with lib.maintainers; [
|
|
ereslibre
|
|
matthewbauer
|
|
nekowinston
|
|
];
|
|
platforms = lib.platforms.unix;
|
|
changelog = "https://github.com/bytecodealliance/wasmtime/blob/v${finalAttrs.version}/RELEASES.md";
|
|
};
|
|
})
|