-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
90 lines (79 loc) · 2.53 KB
/
flake.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
in {
devShells.default = pkgs.mkShell rec {
buildInputs = with pkgs; [
# necessary for building wgpu in 3rd party packages (in most cases)
libxkbcommon
wayland
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
alsa-lib
fontconfig
freetype
shaderc
directx-shader-compiler
pkg-config
cmake
mold # could use any linker, needed for rustix (but mold is fast)
libGL
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers # don't need them *strictly* but immensely helpful
cargo-nextest
cargo-fuzz
cargo-watch
# nice for developing wgpu itself
typos
# if you don't already have rust installed through other means,
# this shell.nix can do that for you with this below
yq # for tomlq below
rustup
# nice tools
gdb
rr
evcxr
valgrind
renderdoc
just
# for this project
nodePackages.browser-sync
];
shellHook = ''
export RUSTC_VERSION="$(tomlq -r .toolchain.channel rust-toolchain.toml)"
export PATH="$PATH:''${CARGO_HOME:-~/.cargo}/bin"
export PATH="$PATH:''${RUSTUP_HOME:-~/.rustup/toolchains/$RUSTC_VERSION-x86_64-unknown-linux/bin}"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
builtins.toString (pkgs.lib.makeLibraryPath buildInputs)
}";
# for this project
cargo install cargo-docs-rs
rustup default $RUSTC_VERSION
rustup toolchain add nightly
rustup component add rust-src rust-analyzer
'';
};
});
}