diff --git a/nix/fixture/Cargo.toml b/nix/fixture/Cargo.toml index 2025ab1..968730a 100644 --- a/nix/fixture/Cargo.toml +++ b/nix/fixture/Cargo.toml @@ -1,4 +1,4 @@ -# cargo-features = ["trim-paths"] +cargo-features = ["trim-paths"] [workspace] members = ["zome"] @@ -12,6 +12,6 @@ serde = "1" [profile.release] opt-level = "z" -# trim-paths = true +trim-paths = true codegen-units = 1 # remap-debuginfo = true diff --git a/nix/fixture/flake.lock b/nix/fixture/flake.lock index 41e3ee4..2ed808d 100644 --- a/nix/fixture/flake.lock +++ b/nix/fixture/flake.lock @@ -895,7 +895,7 @@ }, "locked": { "lastModified": 0, - "narHash": "sha256-UVmiSzZu340XYZW134mqFl58eHvTFIx6s3QTejbLplA=", + "narHash": "sha256-xnrtUhg5qCzKFQ32U8pkRjCrt0UUgMp2z5wShf+4XT8=", "path": "../..", "type": "path" }, diff --git a/nix/zome.nix b/nix/zome.nix index a91e905..ee63205 100644 --- a/nix/zome.nix +++ b/nix/zome.nix @@ -61,7 +61,20 @@ let # pname = crate; # version = cargoToml.package.version; # }); - wasm = pkgs.rustPlatform.buildRustPackage { + rustToolchain = pkgs.rust-bin.nightly."2024-01-29".minimal.override { + # Set the build targets supported by the toolchain, + # wasm32-unknown-unknown is required for trunk. + targets = [ "wasm32-unknown-unknown" ]; + }; + rustPlatform = pkgs.makeRustPlatform { + cargo = rustToolchain; + rustc = rustToolchain; + }; + + wasm = rustPlatform.buildRustPackage { + nativeBuildInputs = [ + pkgs.llvmPackages.bintools + ]; src = workspacePath; pname = crate; version = cargoToml.package.version; @@ -70,6 +83,11 @@ let }; cargoBuildFlags = "--target wasm32-unknown-unknown"; doCheck = false; + CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld"; + installPhase = '' + mkdir -p $out/lib + cp target/wasm32-unknown-unknown/release/*.wasm $out/lib/ + ''; }; in runCommandLocal "${crate}-deterministic" { @@ -77,7 +95,6 @@ let holochainPackageType = "zome"; }; } '' - ls ${wasm}/lib cp ${wasm}/lib/${crate}.wasm $out ''; in