Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
253 lines
4.9 KiB
Nix
253 lines
4.9 KiB
Nix
{
|
|
stdenvNoCC,
|
|
stdenv,
|
|
lib,
|
|
fetchurl,
|
|
dpkg,
|
|
nss,
|
|
nspr,
|
|
xorg,
|
|
pango,
|
|
zlib,
|
|
atkmm,
|
|
libdrm,
|
|
libxkbcommon,
|
|
xcbutilwm,
|
|
xcbutilimage,
|
|
xcbutilkeysyms,
|
|
xcbutilrenderutil,
|
|
libgbm,
|
|
alsa-lib,
|
|
wayland,
|
|
atk,
|
|
qt6,
|
|
at-spi2-atk,
|
|
at-spi2-core,
|
|
dbus,
|
|
cups,
|
|
gtk3,
|
|
libxml2,
|
|
cairo,
|
|
freetype,
|
|
fontconfig,
|
|
vulkan-loader,
|
|
gdk-pixbuf,
|
|
libexif,
|
|
ffmpeg,
|
|
pulseaudio,
|
|
systemd,
|
|
libuuid,
|
|
expat,
|
|
bzip2,
|
|
glib,
|
|
libva,
|
|
libGL,
|
|
libnotify,
|
|
buildFHSEnv,
|
|
writeShellScript,
|
|
runCommandLocal,
|
|
cacert,
|
|
coreutils,
|
|
curl,
|
|
}:
|
|
let
|
|
wechat-uos-env = stdenvNoCC.mkDerivation {
|
|
meta.priority = 1;
|
|
name = "wechat-uos-env";
|
|
buildCommand = ''
|
|
mkdir -p $out/etc
|
|
mkdir -p $out/usr/bin
|
|
mkdir -p $out/usr/share
|
|
mkdir -p $out/opt
|
|
mkdir -p $out/var
|
|
|
|
ln -s ${wechat}/opt/* $out/opt/
|
|
'';
|
|
preferLocalBuild = true;
|
|
};
|
|
|
|
wechat-uos-runtime = with xorg; [
|
|
stdenv.cc.cc
|
|
stdenv.cc.libc
|
|
pango
|
|
zlib
|
|
xcbutilwm
|
|
xcbutilimage
|
|
xcbutilkeysyms
|
|
xcbutilrenderutil
|
|
libX11
|
|
libXt
|
|
libXext
|
|
libSM
|
|
libICE
|
|
libxcb
|
|
libxkbcommon
|
|
libxshmfence
|
|
libXi
|
|
libXft
|
|
libXcursor
|
|
libXfixes
|
|
libXScrnSaver
|
|
libXcomposite
|
|
libXdamage
|
|
libXtst
|
|
libXrandr
|
|
libnotify
|
|
atk
|
|
atkmm
|
|
cairo
|
|
at-spi2-atk
|
|
at-spi2-core
|
|
alsa-lib
|
|
dbus
|
|
cups
|
|
gtk3
|
|
gdk-pixbuf
|
|
libexif
|
|
ffmpeg
|
|
libva
|
|
freetype
|
|
fontconfig
|
|
libXrender
|
|
libuuid
|
|
expat
|
|
glib
|
|
nss
|
|
nspr
|
|
libGL
|
|
libxml2
|
|
pango
|
|
libdrm
|
|
libgbm
|
|
vulkan-loader
|
|
systemd
|
|
wayland
|
|
pulseaudio
|
|
qt6.qt5compat
|
|
bzip2
|
|
];
|
|
|
|
wechat =
|
|
let
|
|
sources = import ./sources.nix;
|
|
|
|
pname = "wechat-uos";
|
|
version = sources.version;
|
|
fetch =
|
|
{
|
|
url,
|
|
hash,
|
|
}:
|
|
runCommandLocal "wechat-uos-${version}-src"
|
|
{
|
|
outputHashAlgo = "sha256";
|
|
outputHash = hash;
|
|
|
|
nativeBuildInputs = [
|
|
curl
|
|
coreutils
|
|
];
|
|
|
|
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
|
|
'';
|
|
|
|
srcs = {
|
|
x86_64-linux = fetch sources.amd64;
|
|
aarch64-linux = fetch sources.arm64;
|
|
loongarch64-linux = fetch sources.loongarch64;
|
|
};
|
|
|
|
src =
|
|
srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
in
|
|
stdenvNoCC.mkDerivation {
|
|
inherit pname src version;
|
|
|
|
nativeBuildInputs = [ dpkg ];
|
|
|
|
unpackPhase = ''
|
|
runHook preUnpack
|
|
|
|
dpkg -x $src ./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;
|
|
runScript = writeShellScript "wechat-uos-launcher" ''
|
|
export QT_QPA_PLATFORM=xcb
|
|
export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
|
export LD_LIBRARY_PATH=${lib.makeLibraryPath wechat-uos-runtime}
|
|
|
|
if [[ ''${XMODIFIERS} =~ fcitx ]]; then
|
|
export QT_IM_MODULE=fcitx
|
|
export GTK_IM_MODULE=fcitx
|
|
elif [[ ''${XMODIFIERS} =~ ibus ]]; then
|
|
export QT_IM_MODULE=ibus
|
|
export GTK_IM_MODULE=ibus
|
|
export IBUS_USE_PORTAL=1
|
|
fi
|
|
|
|
${wechat.outPath}/opt/apps/com.tencent.wechat/files/wechat
|
|
'';
|
|
extraInstallCommands = ''
|
|
mkdir -p $out/share/applications
|
|
mkdir -p $out/share/icons
|
|
cp -r ${wechat.outPath}/opt/apps/com.tencent.wechat/entries/applications/com.tencent.wechat.desktop $out/share/applications
|
|
cp -r ${wechat.outPath}/opt/apps/com.tencent.wechat/entries/icons/* $out/share/icons/
|
|
|
|
substituteInPlace $out/share/applications/com.tencent.wechat.desktop \
|
|
--replace-quiet 'Exec=/usr/bin/wechat' "Exec=$out/bin/wechat-uos --"
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/413491
|
|
sed -i \
|
|
-e '/\[Desktop Entry\]/a\' \
|
|
-e 'StartupWMClass=wechat' \
|
|
$out/share/applications/com.tencent.wechat.desktop
|
|
'';
|
|
targetPkgs = pkgs: [ wechat-uos-env ];
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
extraOutputsToInstall = [
|
|
"usr"
|
|
"var/lib/uos"
|
|
"var/uos"
|
|
"etc"
|
|
];
|
|
}
|