From f409967b04a01079ee5da102b4220a5e0450559f Mon Sep 17 00:00:00 2001 From: Kiskae Date: Wed, 22 Nov 2023 20:12:49 +0100 Subject: [PATCH 1/3] linuxPackages.nvidia_x11: 545.29.02 -> 545.29.06 --- pkgs/os-specific/linux/nvidia-x11/default.nix | 12 ++++++------ pkgs/os-specific/linux/nvidia-x11/open.nix | 8 -------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix index 7fec21a8237b..ecfc04115d00 100644 --- a/pkgs/os-specific/linux/nvidia-x11/default.nix +++ b/pkgs/os-specific/linux/nvidia-x11/default.nix @@ -36,12 +36,12 @@ rec { }; latest = selectHighestVersion production (generic { - version = "545.29.02"; - sha256_64bit = "sha256-RncPlaSjhvBFUCOzWdXSE3PAfRPCIrWAXyJMdLPKuIU="; - sha256_aarch64 = "sha256-Y2RDOuDtiIclr06gmLrPDfE5VFmFamXxiIIKtKAewro="; - openSha256 = "sha256-PukpOBtG5KvZKWYfJHVQO6SuToJUd/rkjpOlEi8pSmk="; - settingsSha256 = "sha256-zj173HCZJaxAbVV/A2sbJ9IPdT1+3yrwyxD+AQdkSD8="; - persistencedSha256 = "sha256-mmMi2pfwzI1WYOffMVdD0N1HfbswTGg7o57x9/IiyVU="; + version = "545.29.06"; + sha256_64bit = "sha256-grxVZ2rdQ0FsFG5wxiTI3GrxbMBMcjhoDFajDgBFsXs="; + sha256_aarch64 = "sha256-o6ZSjM4gHcotFe+nhFTePPlXm0+RFf64dSIDt+RmeeQ="; + openSha256 = "sha256-h4CxaU7EYvBYVbbdjiixBhKf096LyatU6/V6CeY9NKE="; + settingsSha256 = "sha256-YBaKpRQWSdXG8Usev8s3GYHCPqL8PpJeF6gpa2droWY="; + persistencedSha256 = "sha256-AiYrrOgMagIixu3Ss2rePdoL24CKORFvzgZY3jlNbwM="; patchFlags = [ "-p1" "-d" "kernel" ]; patches = []; diff --git a/pkgs/os-specific/linux/nvidia-x11/open.nix b/pkgs/os-specific/linux/nvidia-x11/open.nix index 0625985c908f..a6795c3fd5e7 100644 --- a/pkgs/os-specific/linux/nvidia-x11/open.nix +++ b/pkgs/os-specific/linux/nvidia-x11/open.nix @@ -1,7 +1,6 @@ { stdenv , lib , fetchFromGitHub -, fetchpatch , kernel , nvidia_x11 , hash @@ -19,13 +18,6 @@ stdenv.mkDerivation ({ inherit hash; }; - patches = lib.optionals (nvidia_x11.version == "545.29.02")[ - (fetchpatch { - url = "https://github.com/NVIDIA/open-gpu-kernel-modules/files/13310810/0001-nvkms-initialize-brightnessType-in-_BACKLIGHT_BRIGHT.patch.txt"; - hash = "sha256-9N+DbyT4VmGNTHXWf23PJU4YWZS+0JK7yqkmkpnINPk="; - }) - ]; - nativeBuildInputs = kernel.moduleBuildDependencies; makeFlags = kernel.makeFlags ++ [ From 3281455a2613ceb321e97e6560312b72214214ed Mon Sep 17 00:00:00 2001 From: Kiskae Date: Tue, 28 Nov 2023 15:17:12 +0100 Subject: [PATCH 2/3] nvidiaPackages: format generic.nix --- pkgs/os-specific/linux/nvidia-x11/generic.nix | 142 +++++++++++------- 1 file changed, 87 insertions(+), 55 deletions(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix index 8ec292f27251..e1b6b15f8fe6 100644 --- a/pkgs/os-specific/linux/nvidia-x11/generic.nix +++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix @@ -22,13 +22,22 @@ , prePatch ? "" , postPatch ? null , patchFlags ? null -, patches ? [] +, patches ? [ ] , broken ? false , brokenOpen ? broken }@args: -{ lib, stdenv, callPackage, pkgs, pkgsi686Linux, fetchurl -, kernel ? null, perl, nukeReferences, which, libarchive +{ lib +, stdenv +, callPackage +, pkgs +, pkgsi686Linux +, fetchurl +, kernel ? null +, perl +, nukeReferences +, which +, libarchive , # 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. @@ -42,7 +51,8 @@ # firmware , firmware ? openSha256 != null || useFabricmanager # Whether the user accepts the NVIDIA Software License -, config, acceptLicense ? config.nvidia.acceptLicense or false +, config +, acceptLicense ? config.nvidia.acceptLicense or false }: with lib; @@ -60,9 +70,18 @@ let i686bundled = versionAtLeast version "391" && !disable32Bit; libPathFor = pkgs: lib.makeLibraryPath (with pkgs; [ - libdrm xorg.libXext xorg.libX11 - xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc - wayland mesa libGL openssl + libdrm + xorg.libXext + xorg.libX11 + xorg.libXv + xorg.libXrandr + xorg.libxcb + zlib + stdenv.cc.cc + wayland + mesa + libGL + openssl dbus # for nvidia-powerd ]); @@ -94,29 +113,32 @@ let src = if !acceptLicense && (openSha256 == null) then throwLicense else if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - urls = if args ? url then [ args.url ] else [ - "https://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run" - "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run" - ]; - sha256 = sha256_64bit; - } + fetchurl + { + urls = if args ? url then [ args.url ] else [ + "https://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run" + "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run" + ]; + sha256 = sha256_64bit; + } else if stdenv.hostPlatform.system == "i686-linux" then - fetchurl { - urls = if args ? url then [ args.url ] else [ - "https://us.download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run" - "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run" - ]; - sha256 = sha256_32bit; - } + fetchurl + { + urls = if args ? url then [ args.url ] else [ + "https://us.download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run" + "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run" + ]; + sha256 = sha256_32bit; + } else if stdenv.hostPlatform.system == "aarch64-linux" && sha256_aarch64 != null then - fetchurl { - urls = if args ? url then [ args.url ] else [ - "https://us.download.nvidia.com/XFree86/aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run" - "https://download.nvidia.com/XFree86/Linux-aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run" - ]; - sha256 = sha256_aarch64; - } + fetchurl + { + urls = if args ? url then [ args.url ] else [ + "https://us.download.nvidia.com/XFree86/aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run" + "https://download.nvidia.com/XFree86/Linux-aarch64/${version}/NVIDIA-Linux-aarch64-${version}${pkgSuffix}.run" + ]; + sha256 = sha256_aarch64; + } else throw "nvidia-x11 does not support platform ${stdenv.hostPlatform.system}"; patches = if libsOnly then null else patches; @@ -126,9 +148,9 @@ let inherit i686bundled; outputs = [ "out" ] - ++ optional i686bundled "lib32" - ++ optional (!libsOnly) "bin" - ++ optional (!libsOnly && firmware) "firmware"; + ++ optional i686bundled "lib32" + ++ optional (!libsOnly) "bin" + ++ optional (!libsOnly && firmware) "firmware"; outputDev = if libsOnly then null else "bin"; kernel = if libsOnly then null else kernel.dev; @@ -154,29 +176,38 @@ let disallowedReferences = optionals (!libsOnly) [ kernel.dev ]; - passthru = { - open = mapNullable (hash: callPackage ./open.nix { - inherit hash; - nvidia_x11 = self; - broken = brokenOpen; - }) openSha256; - settings = if useSettings then - (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) { - withGtk2 = preferGtk2; - withGtk3 = !preferGtk2; - } else {}; - persistenced = if usePersistenced then - mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256 - else {}; - fabricmanager = if useFabricmanager then - mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256 - else {}; - inherit persistencedVersion settingsVersion; - compressFirmware = false; - ibtSupport = ibtSupport || (lib.versionAtLeast version "530"); - } // optionalAttrs (!i686bundled) { - inherit lib32; - }; + passthru = + { + open = mapNullable + (hash: callPackage ./open.nix { + inherit hash; + nvidia_x11 = self; + broken = brokenOpen; + }) + openSha256; + settings = + if useSettings then + (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) + { + withGtk2 = preferGtk2; + withGtk3 = !preferGtk2; + } else { }; + persistenced = + if usePersistenced then + mapNullable + (hash: callPackage (import ./persistenced.nix self hash) { }) + persistencedSha256 + else { }; + fabricmanager = + if useFabricmanager then + mapNullable (hash: callPackage (import ./fabricmanager.nix self hash) { }) fabricmanagerSha256 + else { }; + inherit persistencedVersion settingsVersion; + compressFirmware = false; + ibtSupport = ibtSupport || (lib.versionAtLeast version "530"); + } // optionalAttrs (!i686bundled) { + inherit lib32; + }; meta = with lib; { homepage = "https://www.nvidia.com/object/unix.html"; @@ -191,4 +222,5 @@ let }; }; -in self +in +self From 9c24e11f3a9c2eed56792e6288b7feabce265fe1 Mon Sep 17 00:00:00 2001 From: Kiskae Date: Tue, 28 Nov 2023 15:23:20 +0100 Subject: [PATCH 3/3] nvidiaPackages.(settings|persistened): add fallback cdn --- pkgs/os-specific/linux/nvidia-x11/generic.nix | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix index e1b6b15f8fe6..c8957d6193a5 100644 --- a/pkgs/os-specific/linux/nvidia-x11/generic.nix +++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix @@ -33,6 +33,7 @@ , pkgs , pkgsi686Linux , fetchurl +, fetchzip , kernel ? null , perl , nukeReferences @@ -177,6 +178,22 @@ let disallowedReferences = optionals (!libsOnly) [ kernel.dev ]; passthru = + let + fetchFromGithubOrNvidia = { owner, repo, rev, ... }@args: + let + args' = builtins.removeAttrs args [ "owner" "repo" "rev" ]; + baseUrl = "https://github.com/${owner}/${repo}"; + in + fetchzip (args' // { + urls = [ + "${baseUrl}/archive/${rev}.tar.gz" + "https://download.nvidia.com/XFree86/${repo}/${repo}-${rev}.tar.bz2" + ]; + # github and nvidia use different compression algorithms, + # use an invalid file extension to force detection. + extension = "tar.??"; + }); + in { open = mapNullable (hash: callPackage ./open.nix { @@ -191,11 +208,14 @@ let { withGtk2 = preferGtk2; withGtk3 = !preferGtk2; + fetchFromGitHub = fetchFromGithubOrNvidia; } else { }; persistenced = if usePersistenced then mapNullable - (hash: callPackage (import ./persistenced.nix self hash) { }) + (hash: callPackage (import ./persistenced.nix self hash) { + fetchFromGitHub = fetchFromGithubOrNvidia; + }) persistencedSha256 else { }; fabricmanager =