From 9c24e11f3a9c2eed56792e6288b7feabce265fe1 Mon Sep 17 00:00:00 2001 From: Kiskae Date: Tue, 28 Nov 2023 15:23:20 +0100 Subject: [PATCH] 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 =