-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
42 lines (36 loc) · 1.08 KB
/
default.nix
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
42
{ lib, pkgs, system, build_inputs, native_build_inputs, makeRustPlatform }:
let
wasmTarget = "wasm32-unknown-unknown";
rustBin = pkgs.rust-bin.stable.latest.default;
rustBinWasm = rustBin.override { targets = [ wasmTarget ]; };
rustPlatform = makeRustPlatform {
cargo = rustBin;
rustc = rustBin;
};
rustPlatformWasm = makeRustPlatform {
cargo = rustBinWasm;
rustc = rustBinWasm;
};
common = {
version = "0.0.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
buildInputs = build_inputs;
nativeBuildInputs = native_build_inputs;
LD_LIBRARY_PATH = lib.makeLibraryPath build_inputs;
};
in {
lib =
rustPlatform.buildRustPackage (common // { pname = "bevy_shader_mtoon"; });
wasm = rustPlatformWasm.buildRustPackage (common // {
pname = "bevy_shader_mtoon";
buildPhase = ''
cargo build --target ${wasmTarget} --profile wasm-release
'';
installPhase = ''
mkdir -p $out/lib
cp target/${wasmTarget}/wasm-release/*.wasm $out/lib/
'';
});
}