Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pkgs/by-name/we/wechat/darwin.nix
Original file line number Diff line number Diff line change
@@ -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 changes: 30 additions & 0 deletions pkgs/by-name/we/wechat/linux.nix
Original file line number Diff line number Diff line change
@@ -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
'';
}
72 changes: 38 additions & 34 deletions pkgs/by-name/we/wechat/package.nix
Original file line number Diff line number Diff line change
@@ -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
'';

pname = "wechat";
meta = {
description = "Messaging and calling app";
homepage = "https://www.wechat.com/en/";
Expand All @@ -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;
}