Files
nix-config/hardening/nixpaks/wechat.nix
T
ryan4yin | 二花 ccffddc864 feat(wechat): native nixpkgs package with app-scoped data (#492)
Switch to the native deb package from nixpkgs-patched (#560225), remove the AppImage/FHS bwrap layer, and enable native Wayland while keeping the X11 fallback.

Keep only WeChat state under one app-scoped HOME and bind the host Documents and Downloads directories like the other desktop apps. User-selected files also go through the XDG FileChooser portal. Remove the launcher, activation script, and compatibility symlinks.

Assisted-by: DeepSeek Harness (deepseek-flash)
2026-11-01 00:09:27 +08:00

53 lines
1.1 KiB
Nix

{
lib,
wechat,
mkNixPak,
buildEnv,
makeDesktopItem,
runCommandLocal,
...
}:
let
appId = "com.tencent.WeChat";
wrapped = mkNixPak {
config = {
imports = [ ./modules/wechat-policy.nix ];
app = {
package = wechat;
binPath = "bin/wechat";
};
flatpak = { inherit appId; };
};
};
exe = lib.getExe wrapped.config.script;
assets = runCommandLocal "wechat-desktop-assets" { } ''
mkdir -p $out/share
ln -s ${wechat}/share/icons $out/share/icons
'';
in
buildEnv {
inherit (wrapped.config.script) name passthru;
meta = wrapped.config.script.meta // {
mainProgram = "wechat";
};
paths = [
wrapped.config.script
assets
(makeDesktopItem {
name = "wechat";
desktopName = "WeChat";
exec = "${exe} %U";
icon = "${wechat}/share/icons/hicolor/256x256/apps/wechat.png";
terminal = false;
startupWMClass = "wechat";
categories = [
"Network"
"InstantMessaging"
];
mimeTypes = [ "x-scheme-handler/weixin" ];
extraConfig.X-Flatpak = appId;
})
];
}