diff --git a/pkgs/by-name/we/wechat-uos/package.nix b/pkgs/by-name/we/wechat-uos/package.nix index 4e40b4ade627..9b6f1f2a905c 100644 --- a/pkgs/by-name/we/wechat-uos/package.nix +++ b/pkgs/by-name/we/wechat-uos/package.nix @@ -45,6 +45,10 @@ libnotify, buildFHSEnv, writeShellScript, + runCommandLocal, + cacert, + coreutils, + curl, }: let wechat-uos-env = stdenvNoCC.mkDerivation { @@ -123,66 +127,84 @@ let bzip2 ]; - sources = import ./sources.nix; + wechat = + let + sources = import ./sources.nix; - wechat = stdenvNoCC.mkDerivation rec { - pname = "wechat-uos"; - version = sources.version; + pname = "wechat-uos"; + version = sources.version; + fetch = + { + url, + hash, + }: + runCommandLocal "wechat-uos-${version}-src" + { + outputHashAlgo = "sha256"; + outputHash = hash; - src = - { - x86_64-linux = fetchurl { - url = sources.amd64_url; - hash = sources.amd64_hash; - }; - aarch64-linux = fetchurl { - url = sources.arm64_url; - hash = sources.arm64_hash; - }; - loongarch64-linux = fetchurl { - url = sources.loongarch64_url; - hash = sources.loongarch64_hash; - }; - } - .${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); + nativeBuildInputs = [ + curl + coreutils + ]; - nativeBuildInputs = [ dpkg ]; + impureEnvVars = lib.fetchers.proxyImpureEnvVars; + SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; + } + '' + curl -A "debian APT-HTTP/1.3 (1.6.11)" --retry 3 --retry-delay 3 -L "${url}" > $out + ''; - unpackPhase = '' - runHook preUnpack + srcs = { + x86_64-linux = fetch sources.amd64; + aarch64-linux = fetch sources.arm64; + loongarch64-linux = fetch sources.loongarch64; + }; - dpkg -x $src ./wechat-uos + src = + srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); - runHook postUnpack - ''; + in + stdenvNoCC.mkDerivation { + inherit pname src version; - # Use ln for license to prevent being garbage collection - installPhase = '' - runHook preInstall - mkdir -p $out + nativeBuildInputs = [ dpkg ]; - cp -r wechat-uos/* $out + unpackPhase = '' + runHook preUnpack - runHook postInstall - ''; + dpkg -x $src ./wechat-uos - meta = with lib; { - description = "Messaging app"; - homepage = "https://weixin.qq.com/"; - license = licenses.unfree; - platforms = [ - "x86_64-linux" - "aarch64-linux" - "loongarch64-linux" - ]; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - maintainers = with maintainers; [ - pokon548 - xddxdd - ]; - mainProgram = "wechat-uos"; + runHook postUnpack + ''; + + # Use ln for license to prevent being garbage collection + installPhase = '' + runHook preInstall + mkdir -p $out + + cp -r wechat-uos/* $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Messaging app"; + homepage = "https://weixin.qq.com/"; + license = licenses.unfree; + platforms = [ + "x86_64-linux" + "aarch64-linux" + "loongarch64-linux" + ]; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + maintainers = with maintainers; [ + pokon548 + xddxdd + ]; + mainProgram = "wechat-uos"; + }; }; - }; in buildFHSEnv { inherit (wechat) pname version meta; diff --git a/pkgs/by-name/we/wechat-uos/sources.nix b/pkgs/by-name/we/wechat-uos/sources.nix index 4d3a19695a29..20506a002dbe 100644 --- a/pkgs/by-name/we/wechat-uos/sources.nix +++ b/pkgs/by-name/we/wechat-uos/sources.nix @@ -1,11 +1,17 @@ # Generated by ./update.sh - do not update manually! -# Last updated: 2025-02-21 +# Last updated: 2025-09-25 { version = "4.0.1.12"; - amd64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_amd64.deb"; - arm64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_arm64.deb"; - loongarch64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_loongarch64.deb"; - amd64_hash = "sha256-u0NbuB06my+v8yUxQ9CKSHp4nxHAcMEhVzbAozM9nQU="; - arm64_hash = "sha256-GZnIMikYS+TGvTrEl+PT7KyjmXOXXOc0PMxp3Xfpqo8="; - loongarch64_hash = "sha256-dON2EW1+2aiiCTuBdc+IwRAmC/x2bEcQcZcar7WOfZo="; + amd64 = { + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_amd64.deb"; + hash = "sha256-u0NbuB06my+v8yUxQ9CKSHp4nxHAcMEhVzbAozM9nQU="; + }; + arm64 = { + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_arm64.deb"; + hash = "sha256-GZnIMikYS+TGvTrEl+PT7KyjmXOXXOc0PMxp3Xfpqo8="; + }; + loongarch64 = { + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_loongarch64.deb"; + hash = "sha256-dON2EW1+2aiiCTuBdc+IwRAmC/x2bEcQcZcar7WOfZo="; + }; } diff --git a/pkgs/by-name/we/wechat-uos/update.sh b/pkgs/by-name/we/wechat-uos/update.sh index 61c85b671837..ecf2deafa75c 100644 --- a/pkgs/by-name/we/wechat-uos/update.sh +++ b/pkgs/by-name/we/wechat-uos/update.sh @@ -1,7 +1,7 @@ #! /usr/bin/env nix-shell #! nix-shell -i bash --pure --keep GITHUB_TOKEN -p nix git curl cacert nix-prefetch-git gzip -base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle/appstore/binary-" +base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle-pro/appstore/binary-" base_url_appendix="/Packages.gz" target_package="com.tencent.wechat" packages_file="Packages.gz" @@ -13,7 +13,7 @@ hash=() for i in amd64 arm64 loongarch64 do current_url=$base_url_suffix$i$base_url_appendix - curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0" -v -L -O $current_url + curl -A "debian APT-HTTP/1.3 (1.6.11)" -v -L -O $current_url current_version=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" ' BEGIN { found = 0 } { @@ -39,8 +39,8 @@ do } } ') + hash+=("$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 --to sri $sha256sum)") url+=("https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_"$version"_"$i".deb") - hash+=("$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $sha256sum)") done cat >sources.nix <sources.nix <