mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -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);
|
kitchenWasmGen = (import ./nix/kitchenWasm/default.nix);
|
||||||
moduleGen = (import ./nix/kitchen/module.nix);
|
moduleGen = (import ./nix/kitchen/module.nix);
|
||||||
wasm-packGen = (import ./nix/wasm-pack/default.nix);
|
wasm-packGen = (import ./nix/wasm-pack/default.nix);
|
||||||
|
wasm-bindgenGen = (import ./nix/wasm-bindgen/default.nix);
|
||||||
version = "0.2.24";
|
version = "0.2.24";
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
@ -41,8 +42,9 @@
|
|||||||
wasm-pack = wasm-packGen {
|
wasm-pack = wasm-packGen {
|
||||||
inherit rust-wasm naersk-lib pkgs;
|
inherit rust-wasm naersk-lib pkgs;
|
||||||
};
|
};
|
||||||
|
wasm-bindgen = pkgs.callPackage wasm-bindgenGen { inherit pkgs; };
|
||||||
kitchenWasm = kitchenWasmGen {
|
kitchenWasm = kitchenWasmGen {
|
||||||
inherit pkgs rust-wasm version;
|
inherit pkgs rust-wasm wasm-bindgen version;
|
||||||
};
|
};
|
||||||
kitchen = (kitchenGen {
|
kitchen = (kitchenGen {
|
||||||
inherit pkgs version naersk-lib kitchenWasm rust-wasm;
|
inherit pkgs version naersk-lib kitchenWasm rust-wasm;
|
||||||
@ -52,7 +54,7 @@
|
|||||||
root = ./.;
|
root = ./.;
|
||||||
});
|
});
|
||||||
kitchenWasmDebug = kitchenWasmGen {
|
kitchenWasmDebug = kitchenWasmGen {
|
||||||
inherit pkgs rust-wasm version;
|
inherit pkgs rust-wasm wasm-bindgen version;
|
||||||
features = "--features debug_logs";
|
features = "--features debug_logs";
|
||||||
};
|
};
|
||||||
kitchenDebug = (kitchenGen {
|
kitchenDebug = (kitchenGen {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
version,
|
version,
|
||||||
features ? "",
|
features ? "",
|
||||||
rust-wasm,
|
rust-wasm,
|
||||||
|
wasm-bindgen,
|
||||||
}:
|
}:
|
||||||
with pkgs;
|
with pkgs;
|
||||||
let
|
let
|
||||||
@ -22,8 +23,8 @@ stdenv.mkDerivation {
|
|||||||
inherit src pname;
|
inherit src pname;
|
||||||
version = version;
|
version = version;
|
||||||
# we need wasmb-bindgen v0.2.83 exactly
|
# we need wasmb-bindgen v0.2.83 exactly
|
||||||
buildInputs = [ rust-wasm wasm-bindgen-cli wasm-pack binaryen];
|
buildInputs = [ rust-wasm wasm-bindgen wasm-pack binaryen];
|
||||||
propagatedBuildInputs = [ rust-wasm wasm-bindgen-cli wasm-pack binaryen];
|
propagatedBuildInputs = [ rust-wasm wasm-bindgen wasm-pack binaryen];
|
||||||
phases = [ "postUnpackPhase" "buildPhase"];
|
phases = [ "postUnpackPhase" "buildPhase"];
|
||||||
postUnpackPhase = ''
|
postUnpackPhase = ''
|
||||||
ln -s ${cargoDeps} ./cargo-vendor-dir
|
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;
|
my-lib = import ../lib/lib.nix;
|
||||||
in
|
in
|
||||||
{pkgs,
|
{pkgs,
|
||||||
# Because it's a workspace we need the other crates available as source
|
|
||||||
naersk-lib,
|
naersk-lib,
|
||||||
rust-wasm,
|
rust-wasm,
|
||||||
}:
|
}:
|
||||||
@ -11,9 +10,9 @@ with pkgs;
|
|||||||
pname = "wasm-pack";
|
pname = "wasm-pack";
|
||||||
version = "v0.11.0";
|
version = "v0.11.0";
|
||||||
buildInputs = [ rust-wasm pkgs.openssl curl];
|
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];
|
nativeBuildInputs = (my-lib.darwin-sdk pkgs) ++ [llvm clang pkg-config];
|
||||||
OPENSSL_NO_VENDOR=1;
|
OPENSSL_NO_VENDOR=1;
|
||||||
|
# The checks use network so disable them here
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "rustwasm";
|
owner = "rustwasm";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user