From b9f213f07e89843a8ab972a968e1d9d1fb12845b Mon Sep 17 00:00:00 2001 From: Adam Dinwoodie Date: Sat, 23 Nov 2024 18:36:07 +0000 Subject: [PATCH] cups-kyocera-3500-4500: fix broken download URL Kyocera seem to have removed the previous download location, and repackaged their drivers elsewhere, including re-gzipping the previous package. Update the download URL, and rewrite the download mechanism to handle the double-compressed archive. The new unpack code is largely adapted from the fetchzip code. Also add a Wayback Machine URL as an alternative source to reduce the chances the package will break if Kyocera change their URLs again. --- .../cu/cups-kyocera-3500-4500/package.nix | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix b/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix index 32470d4ab4ba..d02c7b63913b 100644 --- a/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix +++ b/pkgs/by-name/cu/cups-kyocera-3500-4500/package.nix @@ -1,6 +1,6 @@ { lib , stdenv -, fetchzip +, fetchurl , cups , autoPatchelfHook , python3Packages @@ -22,18 +22,29 @@ stdenv.mkDerivation rec { dontStrip = true; - src = fetchzip { + src = fetchurl { # Steps to find the release download URL: # 1. Go to https://www.kyoceradocumentsolutions.us/en/support/downloads.html # 2. Search for printer model, e.g. "TASKalfa 6053ci" # 3. Locate e.g. "Linux Print Driver (9.3)" in the list urls = [ - "https://dam.kyoceradocumentsolutions.com/content/dam/gdam_dc/dc_global/executables/driver/product_085/KyoceraLinuxPackages-${date}.tar.gz" + "https://www.kyoceradocumentsolutions.us/content/download-center-americas/us/drivers/drivers/MA_PA_4500ci_Linux_gz.download.gz" + "https://web.archive.org/web/20241123173620/https://www.kyoceradocumentsolutions.us/content/download-center-americas/us/drivers/drivers/MA_PA_4500ci_Linux_gz.download.gz" ]; hash = "sha256-pqBtfKiQo/+cF8fG5vsEQvr8UdxjGsSShXI+6bun03c="; - extension = "tar.gz"; - stripRoot = false; + recursiveHash = true; + downloadToTemp = true; postFetch = '' + unpackDir="$TMPDIR/unpack" + mkdir "$unpackDir" + cd "$unpackDir" + + mv "$downloadedFile" "$TMPDIR/source.tar.gz.gz" + gunzip "$TMPDIR/source.tar.gz.gz" + unpackFile "$TMPDIR/source.tar.gz" + chmod -R +w "$unpackDir" + mv "$unpackDir" "$out" + # delete redundant Linux package dirs to reduce size in the Nix store; only keep Debian rm -r $out/{CentOS,Fedora,OpenSUSE,Redhat,Ubuntu} '';