dev: nix environment
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
{ inputs, flake, self, pkgs }:
|
||||
let
|
||||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../rust-toolchain.toml;
|
||||
runtimeLibraries = with pkgs; [
|
||||
alsa-lib
|
||||
vulkan-loader
|
||||
udev
|
||||
libx11
|
||||
libxcursor
|
||||
libxi
|
||||
libxrandr
|
||||
libxkbcommon
|
||||
wayland
|
||||
];
|
||||
in {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
rustToolchain
|
||||
stdenv.cc
|
||||
git
|
||||
pkg-config
|
||||
shellcheck
|
||||
file
|
||||
openssl
|
||||
] ++ runtimeLibraries;
|
||||
|
||||
shellHook = ''
|
||||
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library"
|
||||
|
||||
if [ -d /run/opengl-driver/lib ]; then
|
||||
export LD_LIBRARY_PATH="/run/opengl-driver/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
fi
|
||||
|
||||
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath runtimeLibraries}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
|
||||
if git_root=$(${pkgs.git}/bin/git rev-parse --show-toplevel 2>/dev/null); then
|
||||
export LOCAL_DIR="$git_root"
|
||||
else
|
||||
export LOCAL_DIR="$PWD"
|
||||
fi
|
||||
|
||||
printf '%s\n' "bevy_controls dev shell"
|
||||
printf '%s\n' "Library: cargo check && cargo test"
|
||||
printf '%s\n' "Example: cd crate/bevy_controls/example/basic && cargo run --features x11"
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user