diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 98cd9dfb0add..d09e71422b2e 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -256,7 +256,9 @@ in open = lib.mkEnableOption '' the open source NVIDIA kernel module - ''; + '' // { + defaultText = lib.literalExpression ''lib.versionAtLeast config.hardware.nvidia.package.version "560"''; + }; }; }; @@ -305,6 +307,8 @@ in extraPackages32 = [ nvidia_x11.lib32 ]; }; environment.systemPackages = [ nvidia_x11.bin ]; + + hardware.nvidia.open = lib.mkDefault (lib.versionAtLeast nvidia_x11.version "560"); }) # X11 diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index dea9ab721a95..06303d0337fd 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -112,16 +112,17 @@ installPhase() { # EGL if [ "$useGLVND" = "1" ]; then - sed -E "s#(libEGL_nvidia)#$i/lib/\\1#" 10_nvidia.json > 10_nvidia.json.fixed - sed -E "s#(libnvidia-egl-wayland)#$i/lib/\\1#" 10_nvidia_wayland.json > 10_nvidia_wayland.json.fixed + mkdir -p "$i/share/egl/egl_external_platform.d" + for icdname in $(find . -name '*_nvidia*.json') + do + cat "$icdname" | jq ".ICD.library_path |= \"$i/lib/\(.)\"" | tee "$i/share/egl/egl_external_platform.d/$icdname" + done - install -Dm644 10_nvidia.json.fixed $i/share/glvnd/egl_vendor.d/10_nvidia.json - install -Dm644 10_nvidia_wayland.json.fixed $i/share/egl/egl_external_platform.d/10_nvidia_wayland.json - - if [[ -f "15_nvidia_gbm.json" ]]; then - sed -E "s#(libnvidia-egl-gbm)#$i/lib/\\1#" 15_nvidia_gbm.json > 15_nvidia_gbm.json.fixed - install -Dm644 15_nvidia_gbm.json.fixed $i/share/egl/egl_external_platform.d/15_nvidia_gbm.json + # glvnd icd + mkdir -p "$i/share/glvnd/egl_vendor.d" + mv "$i/share/egl/egl_external_platform.d/10_nvidia.json" "$i/share/glvnd/egl_vendor.d/10_nvidia.json" + if [[ -f "$i/share/egl/egl_external_platform.d/15_nvidia_gbm.json" ]]; then mkdir -p $i/lib/gbm ln -s $i/lib/libnvidia-allocator.so $i/lib/gbm/nvidia-drm_gbm.so fi diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix index 568027999efa..697db08b9f20 100644 --- a/pkgs/os-specific/linux/nvidia-x11/default.nix +++ b/pkgs/os-specific/linux/nvidia-x11/default.nix @@ -51,12 +51,12 @@ rec { }); beta = selectHighestVersion latest (generic { - version = "555.52.04"; - sha256_64bit = "sha256-nVOubb7zKulXhux9AruUTVBQwccFFuYGWrU1ZiakRAI="; - sha256_aarch64 = "sha256-Kt60kTTO3mli66De2d1CAoE3wr0yUbBe7eqCIrYHcWk="; - openSha256 = "sha256-wDimW8/rJlmwr1zQz8+b1uvxxxbOf3Bpk060lfLKuy0="; - settingsSha256 = "sha256-PMh5efbSEq7iqEMBr2+VGQYkBG73TGUh6FuDHZhmwHk="; - persistencedSha256 = "sha256-KAYIvPjUVilQQcD04h163MHmKcQrn2a8oaXujL2Bxro="; + version = "560.28.03"; + sha256_64bit = "sha256-martv18vngYBJw1IFUCAaYr+uc65KtlHAMdLMdtQJ+Y="; + sha256_aarch64 = "sha256-+u0ZolZcZoej4nqPGmZn5qpyynLvu2QSm9Rd3wLdDmM="; + openSha256 = "sha256-asGpqOpU0tIO9QqceA8XRn5L27OiBFuI9RZ1NjSVwaM="; + settingsSha256 = "sha256-b4nhUMCzZc3VANnNb0rmcEH6H7SK2D5eZIplgPV59c8="; + persistencedSha256 = "sha256-MhITuC8tH/IPhCOUm60SrPOldOpitk78mH0rg+egkTE="; }); # Vulkan developer beta driver diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix index 3f6c5d1caaa3..5907c6e81e43 100644 --- a/pkgs/os-specific/linux/nvidia-x11/generic.nix +++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix @@ -41,6 +41,7 @@ , nukeReferences , which , libarchive +, jq , # Whether to build the libraries only (i.e. not the kernel module or # nvidia-settings). Used to support 32-bit binaries on 64-bit # Linux. @@ -175,7 +176,7 @@ let libPath = libPathFor pkgs; libPath32 = optionalString i686bundled (libPathFor pkgsi686Linux); - nativeBuildInputs = [ perl nukeReferences which libarchive ] + nativeBuildInputs = [ perl nukeReferences which libarchive jq ] ++ optionals (!libsOnly) kernel.moduleBuildDependencies; disallowedReferences = optionals (!libsOnly) [ kernel.dev ]; diff --git a/pkgs/os-specific/linux/nvidia-x11/settings.nix b/pkgs/os-specific/linux/nvidia-x11/settings.nix index fcb804cad6f1..df05a859b4c9 100644 --- a/pkgs/os-specific/linux/nvidia-x11/settings.nix +++ b/pkgs/os-specific/linux/nvidia-x11/settings.nix @@ -9,6 +9,7 @@ nvidia_x11: sha256: , jansson , gtk2 , dbus +, vulkan-headers , gtk3 , libXv , libXrandr @@ -117,7 +118,7 @@ stdenv.mkDerivation { nativeBuildInputs = [ pkg-config m4 addDriverRunpath ] ++ lib.optionals withGtk3 [ wrapGAppsHook3 ]; - buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 dbus ] + buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 dbus vulkan-headers ] ++ lib.optionals (withGtk2 || lib.versionOlder nvidia_x11.settingsVersion "525.53") [ gtk2 ] ++ lib.optionals withGtk3 [ gtk3 librsvg ];