Skip to content

Commit

Permalink
nix: build webapp with crane's buildTrunkPackage
Browse files Browse the repository at this point in the history
  • Loading branch information
pnmadelaine committed Oct 6, 2023
1 parent a485ccb commit a4b5d58
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions nix/packages/webapp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -58,11 +48,4 @@ in
removeReferencesToVendoredSources $file
done
'';
nativeBuildInputs = [
binaryen
nodePackages.sass
trunk
wasm-bindgen-cli
];
doCheck = false;
}

0 comments on commit a4b5d58

Please sign in to comment.