forked from gfx-rs/wgpu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* repo: add shell.nix and .envrc Makes usage on NixOS easier, by not having to drop into a hurry of `nix-shell -p lots of packages` every time someone wants to experiment around with wgpu. The .envrc causes shell.nix to be eval'd automatically run iff 1. direnv is installed 2. the user `direnv allow`ed the shell.nix * repo(shell.nix): add explanations and remove cruft
- Loading branch information
1 parent
ad6774f
commit d30255f
Showing
2 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# This file is only relevant for Nix and NixOS users. | ||
# What's actually meant by "Nix" here is not UNIX, but the *package manager* Nix, see https://nixos.org/. | ||
# If you are | ||
# on macOS (and not using nix-darwin) | ||
# or on Windows (and not using Nix in WSL), | ||
# you can carelessly ignore this file. | ||
# | ||
# Otherwise, if you *do* use Nix the package manager, | ||
# this file declares | ||
# common dependencies | ||
# and some nice tools | ||
# which you'll most likely need when working with wgpu. | ||
# Feel free to copy it into your own project if deemed useful. | ||
# | ||
# To use this file, just run `nix-shell` in this folder, | ||
# which will drop you into a shell | ||
# with all the deps needed for building wgpu available. | ||
# | ||
# Or if you're using direnv (https://direnv.net/), | ||
# use `direnv allow` to automatically always use this file | ||
# if you're navigating into this or a subfolder. | ||
|
||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
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 | ||
|
||
# necessary for developing (all of) wgpu itself | ||
cargo-nextest cargo-fuzz | ||
|
||
# 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 | ||
]; | ||
|
||
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)}"; | ||
rustup default $RUSTC_VERSION | ||
rustup component add rust-src rust-analyzer | ||
''; | ||
} |