-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathai.zcode.ZCode.yaml
More file actions
110 lines (107 loc) · 4.68 KB
/
Copy pathai.zcode.ZCode.yaml
File metadata and controls
110 lines (107 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
app-id: ai.zcode.ZCode
branch: stable
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
command: zcode
rename-icon: zcode
# ZCode is a prebuilt Electron app shipped as a .deb. We don't build it from
# source; we unpack the upstream .deb and install the bundled tree into the
# flatpak. The org.freedesktop.Platform runtime provides GTK3, NSS/NSPR, cups,
# alsa, ATK/at-spi and the graphics stack that the bundled Electron links against.
#
# NOTE: do NOT use `inherit-extensions` for org.freedesktop.Platform.GL /
# VulkanLayer here. Doing so copies the extension *definition* into the app's
# metadata, declaring /app/lib/x86_64-linux-gnu/GL as an app-owned extension
# mount point. At runtime flatpak tries to mkdir that path under the read-only
# /app OSTree deployment, which fails with:
# bwrap: Can't mkdir parents for /app/lib/x86_64-linux-gnu/GL: Read-only file system
# error: ldconfig failed, exit status 256
# The GL/Vulkan stack is provided transparently by the runtime's own
# org.freedesktop.Platform.GL runtime-level extension (mounted into the
# runtime's /usr, not the app's /app), which is how every Electron app on
# Flathub gets working GPU acceleration.
finish-args:
# X11 + Wayland rendering
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri
# Network access (talks to z.ai / GLM APIs)
- --share=network
# PulseAudio / PipeWire audio
- --socket=pulseaudio
# Notifications, secrets (libsecret keyring for credentials) and status notifier
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.freedesktop.secrets
- --talk-name=org.kde.StatusNotifierWatcher
- --talk-name=org.kde.kwalletd5
- --talk-name=org.kde.kwalletd6
# File access: this is a developer tool that edits code, so broad home access is needed.
- --filesystem=home
# ZCode can spawn sub-processes; allow talking to the session portal bus.
- --talk-name=org.freedesktop.Flatpak
# Own its well-known name (status notifier item / app indicator)
- --own-name=org.kde.StatusNotifierItem-2-1
- --own-name=org.kde.StatusNotifierItem.*
modules:
- name: zcode
buildsystem: simple
sources:
- type: file
url: https://cdn-zcode.z.ai/zcode/electron/releases/3.10.2/linux-x64/ZCode-3.10.2-linux-x64.deb
sha256: b618cfa70c8f7c8a1a6e2950565cc441c298b801bb2389c292eb0d3add6bf0c0
only-arches:
- x86_64
dest-filename: ZCode.deb
- type: file
path: ai.zcode.ZCode.appdata.xml
- type: script
dest-filename: zcode-launcher
commands:
# Electron's bundled chrome-sandbox helper must be setuid-root
# (mode 4755, owned by root) to work, which is impossible inside a
# flatpak /app (OSTree forbids setuid binaries there). Since flatpak
# itself is the sandbox (bubblewrap + seccomp), disable Chromium's
# inner setuid sandbox. This is the standard approach for flatpaks
# that wrap a prebuilt Electron binary rather than building against
# org.electronjs.Electron2.BaseApp + zypak.
- exec /app/opt/ZCode/zcode --no-sandbox "$@"
build-commands:
# Unpack the .deb (an ar archive containing data.tar.*).
# The data tarball uses root-relative paths (./opt/ZCode, ./usr/share/...).
- ar -x ZCode.deb
- mkdir unpacked && tar -xf data.tar.* -C unpacked 2>/dev/null || tar -xf data.tar -C unpacked
# Install the bundled Electron app tree
- install -d /app/opt
- cp -a unpacked/opt/ZCode /app/opt/ZCode
- chmod -R a+rX /app/opt/ZCode
# Launcher wrapper on PATH
- install -Dm755 zcode-launcher /app/bin/zcode
# Icons (flatpak caps app icons at 512x512, so skip 1024)
- |
for s in 16 24 32 48 64 128 256 512; do
src="unpacked/usr/share/icons/hicolor/${s}x${s}/apps/zcode.png"
if [ -f "$src" ]; then
install -Dm644 "$src" "/app/share/icons/hicolor/${s}x${s}/apps/zcode.png"
fi
done
# Desktop entry
- |
install -d /app/share/applications
cat > /app/share/applications/ai.zcode.ZCode.desktop <<'EOF'
[Desktop Entry]
Type=Application
Name=ZCode
Comment=Simple, fast, vibe-ready — the official harness for GLM-5.2
Comment[zh_CN]=简单、迅捷、氛围十足 — GLM-5.2 官方适配开发工具
Exec=zcode %U
Icon=zcode
Terminal=false
StartupWMClass=ZCode
Categories=Development;IDE;Utility;
MimeType=x-scheme-handler/zcode;
Keywords=zcode;glm;ai;code;ide;editor;
EOF
# AppData / metainfo
- install -Dm644 ai.zcode.ZCode.appdata.xml /app/share/appdata/ai.zcode.ZCode.appdata.xml