wechat-uos: Fix download (#445949)

authored by Aleksana and committed by GitHub b88a928d 0d99d8b9

+99 -65
+71 -49
pkgs/by-name/we/wechat-uos/package.nix
··· 45 libnotify, 46 buildFHSEnv, 47 writeShellScript, 48 }: 49 let 50 wechat-uos-env = stdenvNoCC.mkDerivation { ··· 123 bzip2 124 ]; 125 126 - sources = import ./sources.nix; 127 128 - wechat = stdenvNoCC.mkDerivation rec { 129 - pname = "wechat-uos"; 130 - version = sources.version; 131 132 - src = 133 - { 134 - x86_64-linux = fetchurl { 135 - url = sources.amd64_url; 136 - hash = sources.amd64_hash; 137 - }; 138 - aarch64-linux = fetchurl { 139 - url = sources.arm64_url; 140 - hash = sources.arm64_hash; 141 - }; 142 - loongarch64-linux = fetchurl { 143 - url = sources.loongarch64_url; 144 - hash = sources.loongarch64_hash; 145 - }; 146 - } 147 - .${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); 148 149 - nativeBuildInputs = [ dpkg ]; 150 151 - unpackPhase = '' 152 - runHook preUnpack 153 154 - dpkg -x $src ./wechat-uos 155 156 - runHook postUnpack 157 - ''; 158 159 - # Use ln for license to prevent being garbage collection 160 - installPhase = '' 161 - runHook preInstall 162 - mkdir -p $out 163 164 - cp -r wechat-uos/* $out 165 166 - runHook postInstall 167 - ''; 168 169 - meta = with lib; { 170 - description = "Messaging app"; 171 - homepage = "https://weixin.qq.com/"; 172 - license = licenses.unfree; 173 - platforms = [ 174 - "x86_64-linux" 175 - "aarch64-linux" 176 - "loongarch64-linux" 177 - ]; 178 - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 179 - maintainers = with maintainers; [ 180 - pokon548 181 - xddxdd 182 - ]; 183 - mainProgram = "wechat-uos"; 184 }; 185 - }; 186 in 187 buildFHSEnv { 188 inherit (wechat) pname version meta;
··· 45 libnotify, 46 buildFHSEnv, 47 writeShellScript, 48 + runCommandLocal, 49 + cacert, 50 + coreutils, 51 + curl, 52 }: 53 let 54 wechat-uos-env = stdenvNoCC.mkDerivation { ··· 127 bzip2 128 ]; 129 130 + wechat = 131 + let 132 + sources = import ./sources.nix; 133 134 + pname = "wechat-uos"; 135 + version = sources.version; 136 + fetch = 137 + { 138 + url, 139 + hash, 140 + }: 141 + runCommandLocal "wechat-uos-${version}-src" 142 + { 143 + outputHashAlgo = "sha256"; 144 + outputHash = hash; 145 146 + nativeBuildInputs = [ 147 + curl 148 + coreutils 149 + ]; 150 151 + impureEnvVars = lib.fetchers.proxyImpureEnvVars; 152 + SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 153 + } 154 + '' 155 + curl -A "debian APT-HTTP/1.3 (1.6.11)" --retry 3 --retry-delay 3 -L "${url}" > $out 156 + ''; 157 158 + srcs = { 159 + x86_64-linux = fetch sources.amd64; 160 + aarch64-linux = fetch sources.arm64; 161 + loongarch64-linux = fetch sources.loongarch64; 162 + }; 163 164 + src = 165 + srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 166 167 + in 168 + stdenvNoCC.mkDerivation { 169 + inherit pname src version; 170 171 + nativeBuildInputs = [ dpkg ]; 172 173 + unpackPhase = '' 174 + runHook preUnpack 175 176 + dpkg -x $src ./wechat-uos 177 178 + runHook postUnpack 179 + ''; 180 + 181 + # Use ln for license to prevent being garbage collection 182 + installPhase = '' 183 + runHook preInstall 184 + mkdir -p $out 185 + 186 + cp -r wechat-uos/* $out 187 + 188 + runHook postInstall 189 + ''; 190 + 191 + meta = with lib; { 192 + description = "Messaging app"; 193 + homepage = "https://weixin.qq.com/"; 194 + license = licenses.unfree; 195 + platforms = [ 196 + "x86_64-linux" 197 + "aarch64-linux" 198 + "loongarch64-linux" 199 + ]; 200 + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; 201 + maintainers = with maintainers; [ 202 + pokon548 203 + xddxdd 204 + ]; 205 + mainProgram = "wechat-uos"; 206 + }; 207 }; 208 in 209 buildFHSEnv { 210 inherit (wechat) pname version meta;
+13 -7
pkgs/by-name/we/wechat-uos/sources.nix
··· 1 # Generated by ./update.sh - do not update manually! 2 - # Last updated: 2025-02-21 3 { 4 version = "4.0.1.12"; 5 - amd64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_amd64.deb"; 6 - arm64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_arm64.deb"; 7 - loongarch64_url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_loongarch64.deb"; 8 - amd64_hash = "sha256-u0NbuB06my+v8yUxQ9CKSHp4nxHAcMEhVzbAozM9nQU="; 9 - arm64_hash = "sha256-GZnIMikYS+TGvTrEl+PT7KyjmXOXXOc0PMxp3Xfpqo8="; 10 - loongarch64_hash = "sha256-dON2EW1+2aiiCTuBdc+IwRAmC/x2bEcQcZcar7WOfZo="; 11 }
··· 1 # Generated by ./update.sh - do not update manually! 2 + # Last updated: 2025-09-25 3 { 4 version = "4.0.1.12"; 5 + amd64 = { 6 + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_amd64.deb"; 7 + hash = "sha256-u0NbuB06my+v8yUxQ9CKSHp4nxHAcMEhVzbAozM9nQU="; 8 + }; 9 + arm64 = { 10 + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_arm64.deb"; 11 + hash = "sha256-GZnIMikYS+TGvTrEl+PT7KyjmXOXXOc0PMxp3Xfpqo8="; 12 + }; 13 + loongarch64 = { 14 + url = "https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_4.0.1.12_loongarch64.deb"; 15 + hash = "sha256-dON2EW1+2aiiCTuBdc+IwRAmC/x2bEcQcZcar7WOfZo="; 16 + }; 17 }
+15 -9
pkgs/by-name/we/wechat-uos/update.sh
··· 1 #! /usr/bin/env nix-shell 2 #! nix-shell -i bash --pure --keep GITHUB_TOKEN -p nix git curl cacert nix-prefetch-git gzip 3 4 - base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle/appstore/binary-" 5 base_url_appendix="/Packages.gz" 6 target_package="com.tencent.wechat" 7 packages_file="Packages.gz" ··· 13 for i in amd64 arm64 loongarch64 14 do 15 current_url=$base_url_suffix$i$base_url_appendix 16 - curl -A "Mozilla/5.0 (X11; Linux x86_64; rv:125.0) Gecko/20100101 Firefox/125.0" -v -L -O $current_url 17 current_version=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" ' 18 BEGIN { found = 0 } 19 { ··· 39 } 40 } 41 ') 42 url+=("https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_"$version"_"$i".deb") 43 - hash+=("$(nix --extra-experimental-features nix-command hash to-sri --type sha256 $sha256sum)") 44 done 45 46 cat >sources.nix <<EOF ··· 48 # Last updated: $(date +%F) 49 { 50 version = "${version[0]}"; 51 - amd64_url = "${url[0]}"; 52 - arm64_url = "${url[1]}"; 53 - loongarch64_url = "${url[2]}"; 54 - amd64_hash = "${hash[0]}"; 55 - arm64_hash = "${hash[1]}"; 56 - loongarch64_hash = "${hash[2]}"; 57 } 58 EOF 59
··· 1 #! /usr/bin/env nix-shell 2 #! nix-shell -i bash --pure --keep GITHUB_TOKEN -p nix git curl cacert nix-prefetch-git gzip 3 4 + base_url_suffix="https://pro-store-packages.uniontech.com/appstore/dists/eagle-pro/appstore/binary-" 5 base_url_appendix="/Packages.gz" 6 target_package="com.tencent.wechat" 7 packages_file="Packages.gz" ··· 13 for i in amd64 arm64 loongarch64 14 do 15 current_url=$base_url_suffix$i$base_url_appendix 16 + curl -A "debian APT-HTTP/1.3 (1.6.11)" -v -L -O $current_url 17 current_version=$(zgrep -A 20 "Package: $target_package" "$packages_file" | awk -v pkg="$target_package" ' 18 BEGIN { found = 0 } 19 { ··· 39 } 40 } 41 ') 42 + hash+=("$(nix --extra-experimental-features nix-command hash convert --hash-algo sha256 --to sri $sha256sum)") 43 url+=("https://pro-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.wechat/com.tencent.wechat_"$version"_"$i".deb") 44 done 45 46 cat >sources.nix <<EOF ··· 48 # Last updated: $(date +%F) 49 { 50 version = "${version[0]}"; 51 + amd64 = { 52 + url = "${url[0]}"; 53 + hash = "${hash[0]}"; 54 + }; 55 + arm64 = { 56 + url = "${url[1]}"; 57 + hash = "${hash[1]}"; 58 + }; 59 + loongarch64 = { 60 + url = "${url[2]}"; 61 + hash = "${hash[2]}"; 62 + }; 63 } 64 EOF 65