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;
});
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; [
(rust.override { extensions = ["rust-src" "rust-analyzer"]; })
pkg-config
cmake
python312
];
libs = 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 ]);
mkRustVulkanShell = { nixGLSupport ? true }: pkgs.mkShell {
nativeBuildInputs = with pkgs; [
(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
{
devShells = {
default = pkgs.mkShell {
inherit nativeBuildInputs;
default = mkRustVulkanShell {};
buildInputs = libs;
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 ]);
};
# Crash with error: cannot coerce null to a string: null
nixos = mkRustVulkanShell { nixGLSupport = false; };
};
packages = {
@ -69,8 +67,7 @@
src = self;
nativeBuildInputs = with pkgs; [ pkg-config shaderc ];
buildInputs = libs;
inherit nativeBuildInputs buildInputs;
cargoLock = {
lockFile = ./Cargo.lock;

View file

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