-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
74 lines (64 loc) · 1.77 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
outputs = {
self,
nixpkgs,
flake-utils,
...
}: let
system = "x86_64-linux";
pkgs = import nixpkgs {inherit system;};
libraries = with pkgs; [
# https://github.com/gfx-rs/wgpu/blame/trunk/shell.nix
alsa-lib
fontconfig
freetype
shaderc
directx-shader-compiler
libGL
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-tools-lunarg
vulkan-extension-layer
vulkan-validation-layers # don't need them *strictly* but immensely helpful
# necessary for developing (all of) wgpu itself
cargo-nextest
cargo-fuzz
# nice for developing wgpu itself
typos
# WINIT_UNIX_BACKEND=wayland
wayland
# WINIT_UNIX_BACKEND=x11
libxkbcommon
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
];
overrides = builtins.fromTOML (builtins.readFile ./rust-toolchain.toml);
in
with pkgs; rec {
devShells.${system}.default = mkShell rec {
buildInputs = with pkgs; [
pkg-config
cmake
mold # could use any linker, needed for rustix (but mold is fast)
# Binaries necessary for this project
openssl
rustup
clippy
];
shellHook = ''
export RUSTC_VERSION="${overrides.toolchain.channel}"
export PATH="$PATH:''${CARGO_HOME:-~/.cargo}/bin"
export PATH="$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/"
export LD_LIBRARY_PATH="${lib.makeLibraryPath libraries}"
rustup default $RUSTC_VERSION
rustup component add rust-src rust-analyzer
'';
};
};
}