Fix NixOS not running

This commit is contained in:
Florian RICHER 2025-01-08 23:12:09 +01:00
parent 3208f62b4a
commit 7ed254f183
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
3 changed files with 20 additions and 25 deletions

2
.envrc
View file

@ -1 +1 @@
use flake use flake --impure

View file

@ -30,36 +30,34 @@
cargo = rust; cargo = rust;
}); });
buildInputs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers ]
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [ libxkbcommon wayland libGL ])
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]);
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
(rust.override { extensions = ["rust-src" "rust-analyzer"]; })
pkg-config pkg-config
cmake cmake
python312 python312
]; ];
libs = with pkgs; [ vulkan-headers vulkan-loader vulkan-validation-layers ] mkRustVulkanShell = { nixGLSupport ? true }: pkgs.mkShell {
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux (with pkgs; [ libxkbcommon wayland libGL ]) nativeBuildInputs = with pkgs; [
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin (with pkgs; [ darwin.apple_sdk.frameworks.SystemConfiguration ]); (rust.override { extensions = ["rust-src" "rust-analyzer"]; })
] ++ nativeBuildInputs;
buildInputs = buildInputs
++ pkgs.lib.optionals nixGLSupport [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanIntel ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
};
in in
{ {
devShells = { devShells = {
default = pkgs.mkShell { default = mkRustVulkanShell {};
inherit nativeBuildInputs;
buildInputs = libs; # Crash with error: cannot coerce null to a string: null
nixos = mkRustVulkanShell { nixGLSupport = false; };
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [ libxkbcommon wayland libGL ]);
};
with_compatibility = pkgs.mkShell {
inherit nativeBuildInputs;
buildInputs = libs ++ [
pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanIntel
];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (with pkgs; [ libxkbcommon wayland libGL ]);
};
}; };
packages = { packages = {
@ -69,8 +67,7 @@
src = self; src = self;
nativeBuildInputs = with pkgs; [ pkg-config shaderc ]; inherit nativeBuildInputs buildInputs;
buildInputs = libs;
cargoLock = { cargoLock = {
lockFile = ./Cargo.lock; lockFile = ./Cargo.lock;

View file

@ -52,8 +52,6 @@ impl App {
enabled_extensions: required_extensions, enabled_extensions: required_extensions,
enabled_layers: vec![ enabled_layers: vec![
String::from("VK_LAYER_KHRONOS_validation"), String::from("VK_LAYER_KHRONOS_validation"),
String::from("VK_LAYER_MANGOHUD_overlay_x86_64"),
String::from("VK_LAYER_NV_optimus"),
], ],
..Default::default() ..Default::default()
}, },