From 34ec2894df4b5da47f337efaedf962dbe83a7f8c Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Thu, 9 Jan 2025 15:33:33 +0100 Subject: [PATCH] Use nixGl auto detection fork to fix NixOS (open source NVIDIA) --- flake.lock | 11 ++++++----- flake.nix | 29 +++++++++++++---------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 9ff2d00..2a584fa 100644 --- a/flake.lock +++ b/flake.lock @@ -28,15 +28,16 @@ ] }, "locked": { - "lastModified": 1713543440, - "narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=", - "owner": "nix-community", + "lastModified": 1735283791, + "narHash": "sha256-JlT4VFs8aVlW+l151HZIZumfFsccZXcO/k5WpbYF09Y=", + "owner": "phirsch", "repo": "nixGL", - "rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a", + "rev": "ea8baea3b9d854bf9cf5c834a805c50948dd2603", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "phirsch", + "ref": "fix-versionMatch", "repo": "nixGL", "type": "github" } diff --git a/flake.nix b/flake.nix index 687120b..1b38c42 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; 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.flake-utils.follows = "flake-utils"; }; @@ -39,25 +40,21 @@ cmake python312 ]; - - 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 = mkRustVulkanShell {}; + default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + (rust.override { extensions = [ "rust-src" "rust-analyzer" ]; }) + ] ++ nativeBuildInputs; - # Crash with error: cannot coerce null to a string: null - nixos = mkRustVulkanShell { nixGLSupport = false; }; + buildInputs = buildInputs + ++ [ pkgs.nixgl.auto.nixVulkanNvidia pkgs.nixgl.nixVulkanMesa ]; + + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; + VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d"; + RUST_LOG = "info,rust_vulkan_test=trace"; + }; }; packages = {