27 lines
532 B
Nix
27 lines
532 B
Nix
# A Wasmtime wrapper that provides our desired configuration.
|
|
{ wasmtime
|
|
, makeWrapper
|
|
, symlinkJoin
|
|
, formats
|
|
, extraSettings ? {}
|
|
}:
|
|
|
|
let
|
|
config = {
|
|
wasm.gc = true;
|
|
};
|
|
config-file =
|
|
(formats.toml {}).generate
|
|
"gyehoek-wasmtime.toml"
|
|
(config // extraSettings);
|
|
in symlinkJoin {
|
|
name = "gyehoek-wasmtime";
|
|
inherit (wasmtime) version;
|
|
paths = [ wasmtime ];
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
postBuild = ''
|
|
wrapProgram $out/bin/wasmtime \
|
|
--add-flags "--config ${config-file}"
|
|
'';
|
|
}
|