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;
|
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;
|
||||||
|
|
|
@ -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()
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue