wechat: init darwin at 4.0.5.24

This commit is contained in:
Sizhe Zhao
2025-06-14 22:29:59 +08:00
parent fc56d01915
commit 69bee52cba
3 changed files with 98 additions and 34 deletions
+30
View File
@@ -0,0 +1,30 @@
{
pname,
version,
src,
meta,
stdenvNoCC,
_7zz,
}:
stdenvNoCC.mkDerivation {
inherit
pname
version
src
meta
;
# dmg is APFS formatted
nativeBuildInputs = [ _7zz ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -a WeChat.app $out/Applications
runHook postInstall
'';
}
+30
View File
@@ -0,0 +1,30 @@
{
pname,
version,
src,
meta,
appimageTools,
}:
let
appimageContents = appimageTools.extract {
inherit pname version src;
postExtract = ''
patchelf --replace-needed libtiff.so.5 libtiff.so $out/opt/wechat/wechat
'';
};
in
appimageTools.wrapAppImage {
inherit pname version meta;
src = appimageContents;
extraInstallCommands = ''
mkdir -p $out/share/applications
cp ${appimageContents}/wechat.desktop $out/share/applications/
mkdir -p $out/share/pixmaps
cp ${appimageContents}/wechat.png $out/share/pixmaps/
substituteInPlace $out/share/applications/wechat.desktop --replace-fail AppRun wechat
'';
}
+38 -34
View File
@@ -1,45 +1,14 @@
{
lib,
appimageTools,
callPackage,
fetchurl,
lib,
stdenvNoCC,
}:
let
inherit (stdenvNoCC.hostPlatform) system;
pname = "wechat";
version = "4.0.1.11";
sources = {
aarch64-linux = fetchurl {
url = "https://web.archive.org/web/20250512112413if_/https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_arm64.AppImage";
hash = "sha256-Rg+FWNgOPC02ILUskQqQmlz1qNb9AMdvLcRWv7NQhGk=";
};
x86_64-linux = fetchurl {
url = "https://web.archive.org/web/20250512110825if_/https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_x86_64.AppImage";
hash = "sha256-gBWcNQ1o1AZfNsmu1Vi1Kilqv3YbR+wqOod4XYAeVKo=";
};
};
src = appimageTools.extract {
inherit pname version;
src = sources.${system};
postExtract = ''
patchelf --replace-needed libtiff.so.5 libtiff.so $out/opt/wechat/wechat
'';
};
in
appimageTools.wrapAppImage {
inherit pname version src;
extraInstallCommands = ''
mkdir -p $out/share/applications
cp ${src}/wechat.desktop $out/share/applications/
mkdir -p $out/share/pixmaps
cp ${src}/wechat.png $out/share/pixmaps/
substituteInPlace $out/share/applications/wechat.desktop --replace-fail AppRun wechat
'';
meta = {
description = "Messaging and calling app";
homepage = "https://www.wechat.com/en/";
@@ -49,8 +18,43 @@ appimageTools.wrapAppImage {
maintainers = with lib.maintainers; [ prince213 ];
mainProgram = "wechat";
platforms = [
"aarch64-darwin"
"x86_64-darwin"
"aarch64-linux"
"x86_64-linux"
];
};
sources =
let
any-darwin = {
version = "4.0.5.24";
src = fetchurl {
url = "https://web.archive.org/web/20250608064358if_/https://dldir1v6.qq.com/weixin/Universal/Mac/WeChatMac.dmg";
hash = "sha256-ieixBgYhZ5jU3TWCV7BXKFBidJ1bbabXBHTkrpNcGDI=";
};
};
in
{
aarch64-darwin = any-darwin;
x86_64-darwin = any-darwin;
aarch64-linux = {
version = "4.0.1.11";
src = fetchurl {
url = "https://web.archive.org/web/20250512112413if_/https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_arm64.AppImage";
hash = "sha256-Rg+FWNgOPC02ILUskQqQmlz1qNb9AMdvLcRWv7NQhGk=";
};
};
x86_64-linux = {
version = "4.0.1.11";
src = fetchurl {
url = "https://web.archive.org/web/20250512110825if_/https://dldir1v6.qq.com/weixin/Universal/Linux/WeChatLinux_x86_64.AppImage";
hash = "sha256-gBWcNQ1o1AZfNsmu1Vi1Kilqv3YbR+wqOod4XYAeVKo=";
};
};
};
in
callPackage (if stdenvNoCC.hostPlatform.isDarwin then ./darwin.nix else ./linux.nix) {
inherit pname meta;
inherit (sources.${system} or (throw "Unsupported system: ${system}")) version src;
}