Files
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.3 KiB
Nix

# WeChat data and its sandbox boundary are owned by nixpak.
{
config,
lib,
pkgs,
sloth,
...
}:
{
imports = [
./desktop-base.nix
./network.nix
];
pasta.mode = "isolate";
desktopIntegration.tray = true;
portalGroups = {
fileChooser = true;
openUri = true;
notifications = true;
screenCast = true;
camera = true;
inputMethod = true;
};
bubblewrap = {
sockets.x11 = true;
# libdbus aborts without /etc/machine-id; use a synthetic app-scoped value.
bind.ro = [
[
(toString (
pkgs.writeText "wechat-machine-id" "${
builtins.substring 0 32 (builtins.hashString "sha256" config.flatpak.appId)
}\n"
))
"/etc/machine-id"
]
];
bind.rw = [
sloth.xdgDocumentsDir
sloth.xdgDownloadDir
];
env = {
# WeChat keeps .xwechat and xwechat_files under HOME. User-selected
# files also go through the XDG file chooser portal where available.
HOME = lib.mkForce (sloth.concat' sloth.xdgDataHome "/wechat");
DISPLAY = sloth.envOr "DISPLAY" "";
XAUTHORITY = sloth.envOr "XAUTHORITY" (sloth.concat' sloth.homeDir "/.Xauthority");
XDG_DOCUMENTS_DIR = sloth.xdgDocumentsDir;
XDG_DOWNLOAD_DIR = sloth.xdgDownloadDir;
PATH = lib.makeBinPath [ pkgs.coreutils ];
};
};
}