From ba64e5a094cda99b9837979f44f589dbd62ffaed Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Thu, 25 Aug 2022 20:35:26 -0400 Subject: [PATCH] Fix cargo dependencies issue with nix wasm-pack --- nix/kitchenWasm/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nix/kitchenWasm/default.nix b/nix/kitchenWasm/default.nix index 38e4886..fb1edf3 100644 --- a/nix/kitchenWasm/default.nix +++ b/nix/kitchenWasm/default.nix @@ -8,6 +8,10 @@ with pkgs; let pname = "kitchen-wasm"; src = ./../..; + lockFile = ./../../Cargo.lock; + # NOTE(jwall): Because we use wasm-pack directly below we need + # the cargo dependencies to already be installed. + cargoDeps = (pkgs.rustPlatform.importCargoLock { inherit lockFile; }); in stdenv.mkDerivation { inherit src pname; @@ -17,7 +21,7 @@ stdenv.mkDerivation { propagatedBuildInputs = [ rust-wasm wasm-bindgen-cli wasm-pack binaryen]; phases = [ "postUnpackPhase" "buildPhase"]; postUnpackPhase = '' - ln -s ${cargoVendorDeps} ./cargo-vendor-dir + ln -s ${cargoDeps} ./cargo-vendor-dir cp -r ./cargo-vendor-dir/.cargo ./ cp -r $src/* ./ '';