Fix NixOS not running
This commit is contained in:
parent
3208f62b4a
commit
7ed254f183
3 changed files with 20 additions and 25 deletions
2
.envrc
2
.envrc
|
@ -1 +1 @@
|
|||
use flake
|
||||
use flake --impure
|
||||
|
|
41
flake.nix
41
flake.nix
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue