From 6d5db91a7f633661e454c50ec40cfb76acf90b10 Mon Sep 17 00:00:00 2001 From: Bu Kun <65808665+pokon548@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:09:36 +0800 Subject: [PATCH] wpsoffice{-cn}: 11.1.0.11711 -> 11.1.0.11719 --- .../applications/office/wpsoffice/default.nix | 49 +++++++++++++++---- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/office/wpsoffice/default.nix b/pkgs/applications/office/wpsoffice/default.nix index d336b9cd5ba5..78b559b8ff3f 100644 --- a/pkgs/applications/office/wpsoffice/default.nix +++ b/pkgs/applications/office/wpsoffice/default.nix @@ -16,20 +16,49 @@ , xorg , cups , pango +, runCommandLocal +, curl +, coreutils +, cacert , useChineseVersion ? false }: - +let + pkgVersion = "11.1.0.11719"; + url = + if useChineseVersion then + "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}_amd64.deb" + else + "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitVersion pkgVersion)}/wps-office_${pkgVersion}.XA_amd64.deb"; + hash = + if useChineseVersion then + "sha256-LgE5du2ZnMsAqgoQkY63HWyWYA5TLS5I8ArRYrpxffs=" + else + "sha256-6fXzHSMzZDGuBubOXsHA0YEUGKcy5QIPg3noyxUbdjA="; + uri = builtins.replaceStrings [ "https://wps-linux-personal.wpscdn.cn" ] [ "" ] url; + securityKey = "7f8faaaa468174dc1c9cd62e5f218a5b"; +in stdenv.mkDerivation rec { pname = "wpsoffice"; - version = "11.1.0.11711"; + version = pkgVersion; - src = if useChineseVersion then fetchurl { - url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitVersion version)}/wps-office_${version}_amd64.deb"; - hash = "sha256-JHSTZZnOZoTpj8zF4C5PmjTkftEdxbeaqweY3ITiJto="; - } else fetchurl { - url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitVersion version)}/wps-office_${version}.XA_amd64.deb"; - hash = "sha256-2apkSE/8Wm6/OQ4x5n1PE1emhovqOgD0NVTY5QZZTYA="; - }; + src = runCommandLocal (if useChineseVersion then "wps-office_${version}_amd64.deb" else "wps-office_${version}.XA_amd64.deb") + { + outputHashMode = "recursive"; + outputHashAlgo = "sha256"; + outputHash = hash; + + nativeBuildInputs = [ curl coreutils ]; + + SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + } '' + timestamp10=$(date '+%s') + md5hash=($(echo -n "${securityKey}${uri}$timestamp10" | md5sum)) + + curl \ + --retry 3 --retry-delay 3 \ + "${url}?t=$timestamp10&k=$md5hash" \ + > $out + ''; unpackCmd = "dpkg -x $src ."; sourceRoot = "."; @@ -102,6 +131,6 @@ stdenv.mkDerivation rec { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; hydraPlatforms = [ ]; license = licenses.unfreeRedistributable; - maintainers = with maintainers; [ mlatus th0rgal rewine ]; + maintainers = with maintainers; [ mlatus th0rgal rewine pokon548 ]; }; }