Use nixGl auto detection fork to fix NixOS (open source NVIDIA)

This commit is contained in:
Florian RICHER 2025-01-09 15:33:33 +01:00
parent 7ed254f183
commit 34ec2894df
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
2 changed files with 19 additions and 21 deletions

View file

@ -28,15 +28,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1713543440, "lastModified": 1735283791,
"narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=", "narHash": "sha256-JlT4VFs8aVlW+l151HZIZumfFsccZXcO/k5WpbYF09Y=",
"owner": "nix-community", "owner": "phirsch",
"repo": "nixGL", "repo": "nixGL",
"rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a", "rev": "ea8baea3b9d854bf9cf5c834a805c50948dd2603",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "phirsch",
"ref": "fix-versionMatch",
"repo": "nixGL", "repo": "nixGL",
"type": "github" "type": "github"
} }

View file

@ -9,7 +9,8 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixgl = { nixgl = {
url = "github:nix-community/nixGL"; # Revert this to community version when https://github.com/nix-community/nixGL/pull/187 is merged
url = "github:phirsch/nixGL/fix-versionMatch";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
@ -39,25 +40,21 @@
cmake cmake
python312 python312
]; ];
in
mkRustVulkanShell = { nixGLSupport ? true }: pkgs.mkShell { {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
(rust.override { extensions = [ "rust-src" "rust-analyzer" ]; }) (rust.override { extensions = [ "rust-src" "rust-analyzer" ]; })
] ++ nativeBuildInputs; ] ++ nativeBuildInputs;
buildInputs = buildInputs buildInputs = buildInputs
++ pkgs.lib.optionals nixGLSupport [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanIntel ]; ++ [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanMesa ];
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d"; VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
RUST_LOG = "info,rust_vulkan_test=trace";
}; };
in
{
devShells = {
default = mkRustVulkanShell {};
# Crash with error: cannot coerce null to a string: null
nixos = mkRustVulkanShell { nixGLSupport = false; };
}; };
packages = { packages = {