From 378c68ee8f3d1e388790c7cd8417e0d4e16c8c36 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Mon, 22 Apr 2024 14:58:58 +0200 Subject: [PATCH 1/2] fix: forward nvidiaHash for nixgl.auto derivation too This allows separating the *use* of nixgl.auto.nixGLDefault from the location where we pass nvidiaHash to provide a pure instantiation. --- nixGL.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nixGL.nix b/nixGL.nix index e8556c8..19816b0 100644 --- a/nixGL.nix +++ b/nixGL.nix @@ -236,7 +236,10 @@ let versionMatch = builtins.match ".*Module ([0-9.]+) .*" data; in if versionMatch != null then builtins.head versionMatch else null; - autoNvidia = nvidiaPackages {version = nvidiaVersionAuto; }; + autoNvidia = nvidiaPackages { + version = nvidiaVersionAuto; + sha256 = nvidiaHash; + }; in rec { # The output derivation contains nixGL which point either to # nixGLNvidia or nixGLIntel using an heuristic. From 12f8b902bb28615650b1fa9f334950ace9f9ebe8 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Mon, 22 Apr 2024 15:05:25 +0200 Subject: [PATCH 2/2] refactor: reuse nixgl.auto when nVidia is forced Instead of duplicating its definition, because that leaves the possibility for bugs when these duplicates aren't in sync. --- nixGL.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/nixGL.nix b/nixGL.nix index 19816b0..587b80d 100644 --- a/nixGL.nix +++ b/nixGL.nix @@ -249,10 +249,5 @@ let nixGLCommon nixGLIntel; } // autoNvidia; }; -in top // (if nvidiaVersion != null then - top.nvidiaPackages { - version = nvidiaVersion; - sha256 = nvidiaHash; - } -else - { }) +in top // lib.optionalAttrs (nvidiaVersion != null) +(builtins.removeAttrs top.auto [ "nixGLDefault" ])