Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
66 lines (57 loc) · 1.95 KB
/
Copy pathflake.nix
File metadata and controls
66 lines (57 loc) · 1.95 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
{
description = "Rust4D - 4D game engine development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Runtime libraries wgpu/winit/cpal need to dlopen
runtimeLibs = with pkgs; [
vulkan-loader
wayland
libxkbcommon
# X11 fallback for winit
libx11
libxcursor
libxi
libxrandr
# audio (kira -> cpal -> alsa)
alsa-lib
];
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
# Rust toolchain
rustc
cargo
clippy
rustfmt
rust-analyzer
# Build deps
pkg-config
alsa-lib
# GPU debugging / verification
vulkan-tools # vulkaninfo
vulkan-validation-layers
mesa # lavapipe software rasterizer for headless runs
# Visual verification tooling
grim # Wayland screenshots (Hyprland)
slurp # region selection
imagemagick # compare/montage/identify for image diffing
];
buildInputs = runtimeLibs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs;
shellHook = ''
echo "Rust4D dev shell — $(rustc --version)"
# Use the system Vulkan ICDs (NixOS exposes them via /run/opengl-driver)
if [ -d /run/opengl-driver/share/vulkan/icd.d ] && [ -z "''${VK_DRIVER_FILES:-}" ]; then
export VK_DRIVER_FILES=$(ls /run/opengl-driver/share/vulkan/icd.d/*.json | tr '\n' ':' | sed 's/:$//')
fi
'';
};
});
}