mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-21 19:29:49 -04:00
Add wasm-bindgen directly to the toolchain
This commit is contained in:
parent
4ef59c1ef0
commit
992f4248b2
@ -18,6 +18,7 @@
|
||||
kitchenWasmGen = (import ./nix/kitchenWasm/default.nix);
|
||||
moduleGen = (import ./nix/kitchen/module.nix);
|
||||
wasm-packGen = (import ./nix/wasm-pack/default.nix);
|
||||
wasm-bindgenGen = (import ./nix/wasm-bindgen/default.nix);
|
||||
version = "0.2.24";
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
@ -41,8 +42,9 @@
|
||||
wasm-pack = wasm-packGen {
|
||||
inherit rust-wasm naersk-lib pkgs;
|
||||
};
|
||||
wasm-bindgen = pkgs.callPackage wasm-bindgenGen { inherit pkgs; };
|
||||
kitchenWasm = kitchenWasmGen {
|
||||
inherit pkgs rust-wasm version;
|
||||
inherit pkgs rust-wasm wasm-bindgen version;
|
||||
};
|
||||
kitchen = (kitchenGen {
|
||||
inherit pkgs version naersk-lib kitchenWasm rust-wasm;
|
||||
@ -52,7 +54,7 @@
|
||||
root = ./.;
|
||||
});
|
||||
kitchenWasmDebug = kitchenWasmGen {
|
||||
inherit pkgs rust-wasm version;
|
||||
inherit pkgs rust-wasm wasm-bindgen version;
|
||||
features = "--features debug_logs";
|
||||
};
|
||||
kitchenDebug = (kitchenGen {
|
||||
|
@ -2,6 +2,7 @@
|
||||
version,
|
||||
features ? "",
|
||||
rust-wasm,
|
||||
wasm-bindgen,
|
||||
}:
|
||||
with pkgs;
|
||||
let
|
||||
@ -22,8 +23,8 @@ stdenv.mkDerivation {
|
||||
inherit src pname;
|
||||
version = version;
|
||||
# we need wasmb-bindgen v0.2.83 exactly
|
||||
buildInputs = [ rust-wasm wasm-bindgen-cli wasm-pack binaryen];
|
||||
propagatedBuildInputs = [ rust-wasm wasm-bindgen-cli wasm-pack binaryen];
|
||||
buildInputs = [ rust-wasm wasm-bindgen wasm-pack binaryen];
|
||||
propagatedBuildInputs = [ rust-wasm wasm-bindgen wasm-pack binaryen];
|
||||
phases = [ "postUnpackPhase" "buildPhase"];
|
||||
postUnpackPhase = ''
|
||||
ln -s ${cargoDeps} ./cargo-vendor-dir
|
||||
|
40
nix/wasm-bindgen/default.nix
Normal file
40
nix/wasm-bindgen/default.nix
Normal file
@ -0,0 +1,40 @@
|
||||
let
|
||||
my-lib = import ../lib/lib.nix;
|
||||
in
|
||||
{ pkgs
|
||||
, lib
|
||||
, rustPlatform
|
||||
, fetchCrate
|
||||
, nodejs
|
||||
, pkg-config
|
||||
, openssl
|
||||
, stdenv
|
||||
, curl
|
||||
, runCommand
|
||||
}:
|
||||
|
||||
# This package is special so we don't use the naersk infrastructure to build it.
|
||||
# Instead we crib from the nixpkgs version with some tweaks to work with our
|
||||
# flake setup.
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "wasm-bindgen-cli";
|
||||
# NOTE(jwall): This must exactly match the version of the wasm-bindgen crate
|
||||
# we are using.
|
||||
version = "0.2.84";
|
||||
|
||||
src = fetchCrate {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-0rK+Yx4/Jy44Fw5VwJ3tG243ZsyOIBBehYU54XP/JGk=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-vcpxcRlW1OKoD64owFF6mkxSqmNrvY+y3Ckn5UwEQ50=";
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
|
||||
buildInputs = [ openssl curl ] ++ (my-lib.darwin-sdk pkgs);
|
||||
|
||||
nativeCheckInputs = [ nodejs ];
|
||||
|
||||
# other tests require it to be ran in the wasm-bindgen monorepo
|
||||
cargoTestFlags = [ "--test=interface-types" ];
|
||||
}
|
@ -2,7 +2,6 @@ let
|
||||
my-lib = import ../lib/lib.nix;
|
||||
in
|
||||
{pkgs,
|
||||
# Because it's a workspace we need the other crates available as source
|
||||
naersk-lib,
|
||||
rust-wasm,
|
||||
}:
|
||||
@ -11,9 +10,9 @@ with pkgs;
|
||||
pname = "wasm-pack";
|
||||
version = "v0.11.0";
|
||||
buildInputs = [ rust-wasm pkgs.openssl curl];
|
||||
# However the crate we are building has it's root in specific crate.
|
||||
nativeBuildInputs = (my-lib.darwin-sdk pkgs) ++ [llvm clang pkg-config];
|
||||
OPENSSL_NO_VENDOR=1;
|
||||
# The checks use network so disable them here
|
||||
doCheck = false;
|
||||
src = fetchFromGitHub {
|
||||
owner = "rustwasm";
|
||||
|
Loading…
x
Reference in New Issue
Block a user