blob: e418992bf300582e77b91eefac854e4309c90689 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
{
outputs = {
self,
nixpkgs,
}: let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
buildRustPackage =
pkgs.rustPlatform.buildRustPackage.override
{rustc = pkgs.rustc-wasm32;};
rust-lld = pkgs.symlinkJoin {
name = "rust-lld";
paths = [pkgs.rustc-wasm32.llvmPackages.lld];
postBuild = ''
ln -s $out/bin/lld $out/bin/rust-lld
'';
};
in {
packages.x86_64-linux.default = buildRustPackage rec {
name = "gems";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
doCheck = false;
buildPhase = ''
cargo build --target wasm32-unknown-unknown --release
wasm-bindgen --out-name gems \
--out-dir $out \
--target web target/wasm32-unknown-unknown/release/gems.wasm
'';
installPhase = ''
cp -r assets $out
cp index.html $out
'';
nativeBuildInputs = [
rust-lld
pkgs.wasm-bindgen-cli
];
};
};
}
|