fix(nvidia): force use of latest egl with beta drivers
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-08-18 11:00:55 -04:00
parent e79238f15f
commit 40e8fb874a

View file

@ -4,7 +4,8 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf mkEnableOption mkOption optionals types; inherit (builtins) toJSON;
inherit (lib) mkIf mkEnableOption mkOption optionals optionalString types;
cfg = config.nvidia; cfg = config.nvidia;
in { in {
@ -61,13 +62,11 @@ in {
open = false; open = false;
package = let package = let
inherit (config.boot.kernelPackages.nvidiaPackages) stable latest; inherit (config.boot.kernelPackages.nvidiaPackages) beta stable;
in in
if !cfg.enableWayland if !cfg.enableWayland
then stable then stable
else else beta;
# Stick to 555 driver version for better Wayland support
latest;
}; };
environment.systemPackages = environment.systemPackages =
@ -83,6 +82,32 @@ in {
boot.kernelModules = boot.kernelModules =
optionals cfg.enableCUDA ["nvidia-uvm"] optionals cfg.enableCUDA ["nvidia-uvm"]
++ ["nvidia" "nvidia-drm"]; ++ ["nvidia" "nvidia-drm"];
# Fixes egl-wayland issues with beta drivers
environment.etc = let
mkEglFile = n: library: let
suffix = optionalString (library != "wayland") ".1";
pkg =
if library != "wayland"
then config.hardware.nvidia.package
else pkgs.egl-wayland;
fileName = "${toString n}_nvidia_${library}.json";
library_path = "${pkg}/lib/libnvidia-egl-${library}.so${suffix}";
in {
"egl/egl_external_platform.d/${fileName}".source = pkgs.writeText fileName (toJSON {
file_format_version = "1.0.0";
ICD = {inherit library_path;};
});
};
in
mkIf cfg.enableWayland (
{"egl/egl_external_platform.d".enable = false;}
// mkEglFile 10 "wayland"
// mkEglFile 15 "gbm"
// mkEglFile 20 "xcb"
// mkEglFile 20 "xlib"
);
}; };
# For accurate stack trace # For accurate stack trace