From a4b5d58740363f4ae8d626a8951fb6116af5613e Mon Sep 17 00:00:00 2001 From: Paul-Nicolas Madelaine Date: Fri, 6 Oct 2023 02:13:40 +0200 Subject: [PATCH] nix: build webapp with crane's `buildTrunkPackage` --- nix/packages/webapp.nix | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/nix/packages/webapp.nix b/nix/packages/webapp.nix index 57b195fb..e4bf128f 100644 --- a/nix/packages/webapp.nix +++ b/nix/packages/webapp.nix @@ -26,28 +26,18 @@ nodeDependencies = (pkgs.callPackage ../../typhon-webapp/npm-nix {}).nodeDependencies; - - inherit - (pkgs) - nodePackages - binaryen - trunk - wasm-bindgen-cli - ; in - craneLib.buildPackage { + craneLib.buildTrunkPackage { inherit src cargoToml cargoArtifacts RUSTFLAGS ; - buildPhaseCargoCommand = '' + trunkIndexPath = "typhon-webapp/index.html"; + preBuild = '' ln -s ${nodeDependencies}/lib/node_modules typhon-webapp/node_modules - # See #351 on Trunk - echo "tools.wasm_bindgen = \"$(wasm-bindgen --version | cut -d' ' -f2)\"" >> Trunk.toml echo "build.public_url = \"WEBROOT\"" >> Trunk.toml - trunk build --release typhon-webapp/index.html ''; # we only need to remove references on *.wasm files doNotRemoveReferencesToVendorDir = true; @@ -58,11 +48,4 @@ in removeReferencesToVendoredSources $file done ''; - nativeBuildInputs = [ - binaryen - nodePackages.sass - trunk - wasm-bindgen-cli - ]; - doCheck = false; }