-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
68 lines (63 loc) · 1.94 KB
/
flake.nix
File metadata and controls
68 lines (63 loc) · 1.94 KB
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
66
67
68
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
fenix.url = "github:nix-community/fenix/monthly";
crane.url = "github:ipetkov/crane";
};
outputs = { self, crane, flake-utils, fenix, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import (nixpkgs) { inherit system; });
deps = with pkgs; [
openssl
udev
alsa-lib
vulkan-loader
clang
lld
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
libxkbcommon
wayland
];
in
rec {
packages.wasm =
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = (crane.mkLib pkgs).overrideToolchain (with fenix.packages.${system};
combine [
minimal.cargo
minimal.rustc
targets.wasm32-unknown-unknown.latest.rust-std
]);
in
craneLib.buildPackage rec {
src = ./.;
doCheck = false;
buildInputs = with pkgs; [ clang wasm-bindgen-cli ];
CARGO_BUILD_TARGET = "wasm32-unknown-unknown";
BEVY_ASSET_PATH = "${src}/assets";
postInstall = "wasm-bindgen --no-typescript --target web --out-dir $out/wasm/ --out-name \"bevy-template\" $out/bin/bevy-template.wasm";
};
devShell =
let
toolchain = fenix.packages.${system}.latest.toolchain;
in
pkgs.mkShell rec {
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs =
[
toolchain
] ++ deps;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
shellHook = ''
echo "[🦀 Rust] environment is ready"
rustc --version
'';
};
});
}