-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.nix
65 lines (52 loc) · 1.3 KB
/
build.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
pkgs,
makeRustPlatform,
mkYarnPackage,
fetchYarnDeps,
}: let
targetName = "wasm32-unknown-unknown";
wasm-rust = pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-src"];
targets = [targetName];
};
rustPlatformWasm = makeRustPlatform {
cargo = wasm-rust;
rustc = wasm-rust;
};
wasm-build = rustPlatformWasm.buildRustPackage {
name = "css-typing-gen";
cargoLock.lockFile = ./Cargo.lock;
src = ./.;
nativeBuildInputs = with pkgs; [
wasm-bindgen-cli
];
buildInputs = with pkgs; [
openssl
pkg-config
gnumake
];
buildPhase = ''
cargo build --target ${targetName} --release
wasm-bindgen target/${targetName}/release/css_typing_gen.wasm --out-dir=$out/pkg
'';
installPhase = "echo 'Skipping installPhase'";
};
in
mkYarnPackage rec {
src = ./www;
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-pD+mvbYsow+b3G+u+zDfNjOJ2mVbujver8jDke8J864=";
};
buildPhase = ''
ln -s ${wasm-build}/pkg ../pkg
export HOME=$(mktemp -d)
yarn --offline build
cp -r dist $out
'';
doDist = false;
configurePhase = ''
ln -s $node_modules node_modules
'';
installPhase = "echo 'Skipping installPhase'";
}