Skip to content

feat(packaging): add Flatpak manifest (#40) - #197

Open
amanmprojects wants to merge 4 commits into
am-will:mainfrom
amanmprojects:feat/flatpak-packaging
Open

amanmprojects wants to merge 4 commits into
am-will:mainfrom
amanmprojects:feat/flatpak-packaging

Conversation

@amanmprojects

Copy link
Copy Markdown

Refs #40.

Adds a flatpak/ directory with a flatpak-builder manifest that builds the same artifacts as PKGBUILD-source.template, rooted at /app.

What's here

  • flatpak/dev.limux.linux.yml — app-id dev.limux.linux, matching the existing dev.limux.linux.desktop / dev.limux.linux.metainfo.xml. Runtime org.gnome.Platform//48 (GTK4 / libadwaita / WebKitGTK / Mesa), with the rust-stable and ziglang SDK extensions. It builds libghostty with the exact Zig args from the AUR recipe, builds the Rust workspace --offline --locked, and installs the CLI (/app/bin/limux), the GTK host (/app/libexec/limux/limux-host), libghostty-internal.so (/app/lib/limux), and Ghostty resources + terminfo (/app/share/limux).
  • flatpak/cargo-sources.json — offline sources for all 147 crates.io dependencies, generated from Cargo.lock. The workspace has no git deps, so it's fully offline; checksums come straight from the lockfile.
  • flatpak/README.md — build steps, install-layout table, and finish-args rationale.

Design notes

  • limux-host-linux already resolves Ghostty resources relative to its own executable (set_ghostty_runtime_env_for_exe), so the /app tree is discovered at runtime with no hardcoded /usr paths.
  • RUSTFLAGS overrides the /usr/local/lib/limux rpath from .cargo/config.toml with /app/lib/limux, keeping --export-dynamic for the Ghostty FFI symbol lookup.
  • finish-args: --device=dri for Ghostty's OpenGL rendering, --share=network for terminals and the built-in browser, portal --talk-names for WebKitGTK's sandboxed helpers, and --filesystem=host (a terminal running arbitrary shell commands can't be confined to a subtree).

Draft — two open items before Flathub

Filed as a draft because two things still need doing, both documented in the README:

  1. Offline vendoring of Ghostty's own Zig build dependencies. The Rust side is fully vendored; the zig build step in the ghostty submodule still fetches its Zig packages, which Flathub's network-less builds disallow. Until vendored, build locally with a network-enabled build.
  2. End-to-end build + GUI test on a machine with a display. The manifest structure, install layout, and crate checksums are validated (YAML parses, cargo-sources.json checksums verified against Cargo.lock), but it hasn't been run through flatpak-builder or launched as a GUI yet — I don't have a display-capable environment here.

Happy to iterate on the runtime version, finish-args scope, or the Zig-vendoring approach.

🤖 Generated with Claude Code

Adds a flatpak-builder manifest under flatpak/, building the same
artifacts as the source AUR recipe (PKGBUILD-source.template) but rooted
at /app:

- dev.limux.linux.yml — app-id matches the existing desktop/metainfo
  files. Builds libghostty (Zig), then the Rust workspace offline against
  vendored crates, and installs the CLI (/app/bin/limux), GTK host
  (/app/libexec/limux/limux-host), libghostty-internal.so
  (/app/lib/limux), and Ghostty resources/terminfo (/app/share/limux).
  RUSTFLAGS overrides the .cargo/config.toml rpath with /app/lib/limux;
  finish-args cover Wayland/X11, the DRI device for Ghostty's GL
  rendering, network, and the XDG portals WebKitGTK's helpers use.
- cargo-sources.json — offline sources for all 147 crates.io deps,
  generated from Cargo.lock (no git deps; checksums verified against
  the lockfile).
- README.md — build steps, install layout, finish-args rationale, and
  the two open items before Flathub submission (offline vendoring of
  Ghostty's own Zig build deps, and an end-to-end build/GUI test on a
  machine with a display).

Refs am-will#40

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bvolpato

Copy link
Copy Markdown
Collaborator

I reviewed this draft at head 3447834 against current main. The Cargo source list matches the 147 crates in Cargo.lock, but I found four issues to address in addition to the two open items already documented here:

  1. Build checkout (flatpak/dev.limux.linux.yml:85-92): Flatpak-builder checks out Git submodules by default, so the first Limux source already populates ghostty/ at the pinned commit. The second Git source targeting dest: ghostty then conflicts with the existing submodule checkout. Remove the redundant source, or disable submodules on the first source before supplying Ghostty separately. Flatpak-builder Git source behavior.
  2. Host shell (:37-40): --filesystem=host shares project files, but it does not expose host /usr or /bin inside the sandbox. Limux starts terminal shells through Ghostty without a host-spawn wrapper, so host-installed tools such as git and cargo are unavailable in those terminals. Please add and validate a host shell execution path, including PTY, environment, and working-directory behavior. Flatpak filesystem rules.
  3. Action icons (:78-82): The manifest installs app PNGs but omits the three limux-*-symbolic.svg action icons used by the browser and split buttons. The source AUR recipe installs them into share/icons/hicolor/scalable/actions; please do the same here.
  4. Runtime (:16): Flathub marks GNOME SDK 48 end of life as of March 24, 2026. A new Flathub submission needs a supported runtime and matching SDK extensions. Flathub policy.

The documented Zig dependency vendoring and an actual Flatpak build plus GUI smoke test are still needed. I would keep this in draft until those checks pass.

amanmprojects and others added 3 commits September 22, 2026 12:26
…lision

Building through flatpak-builder revealed that the repo's `ghostty`
submodule and the pinned `ghostty` git source both target the same
directory, so the build died with a `.git` cp collision. Set
`disable-submodules: true` on the limux source and let the pinned source
own that directory. Also record what the build run validated (source
resolution, cargo vendoring, Zig 0.16 in the ziglang//24.08 extension)
and what still needs finishing.

Refs am-will#40

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Building end to end surfaced that the GTK4 Rust crates (gdk4 0.11,
cairo-rs/gdk-pixbuf 0.22) require rustc >= 1.92, but the GNOME 48
(freedesktop 24.08) rust-stable extension only ships rustc 1.89, so the
Rust build fails there. Bump runtime-version to 49 (freedesktop 25.08;
rust-stable 1.98, ziglang still 0.16.0).

Verified: the manifest now builds end to end via org.flatpak.Builder on
GNOME 49 and `flatpak run dev.limux.linux` maps a GTK window titled
"Limux v0.1.30". README updated with the verification status and the
remaining Flathub open item (offline vendoring of Ghostty's Zig deps;
the verifying build used --share=network for the zig step).

Refs am-will#40

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
org.freedesktop.portal.Documents/Flatpak are granted to sandboxed apps
by default, so requesting them explicitly is a flatpak-builder-lint
error (finish-args-portal-talk-name). Drop both; keep Notifications.
Refresh README open items now that build+launch is verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@amanmprojects
amanmprojects marked this pull request as ready for review September 22, 2026 11:47
@amanmprojects

Copy link
Copy Markdown
Author

Taking this out of draft — it now builds end to end and launches.

Verified (GNOME 49 / freedesktop 25.08): org.flatpak.Builder builds the Zig libghostty engine + the Rust workspace fully offline against cargo-sources.json, installs to /app, and flatpak run dev.limux.linux maps the GTK window ("Limux v0.1.30") and brings up its control socket. Three things fell out of actually building it, all now in the manifest/README:

  • disable-submodules: true on the limux source — its ghostty submodule collides with the pinned ghostty git source over the same dir.
  • GNOME 49 is the floor, not 48: gdk4 0.11 / cairo-rs 0.22 need rustc ≥ 1.92 and the 24.08 rust-stable extension only ships 1.89.
  • Build/state dirs must live under $HOME — flatpak apps get a private /tmp the nested build sandbox can't see.

flatpak-builder-lint is clean except two entries that are genuinely your call, not defects:

  • finish-args-host-filesystem-access — --filesystem=host is deliberate (a terminal that runs arbitrary shells can't be confined to a subtree). Narrow it if you'd rather.
  • appid-url-not-reachable — lint expects limux.dev (from the app-id) to resolve; that's a domain/branding decision.

Two things I did not want to decide for you, left as open items in the README:

  1. Offline Zig vendoring. The Rust side is fully vendored; the zig build step still fetches Ghostty's own Zig packages, so the verifying build used a --share=network build-arg. Flathub builds are network-less, so those need prefetching/vendoring before submission.
  2. metainfo screenshots + <releases> — lint wants both before Flathub, and upstream owns that file.

So: fully working as a locally-built Flatpak today; the remaining gap to a Flathub submission is the Zig vendoring + metainfo, both of which touch decisions I'd rather leave to you.

@bvolpato bvolpato left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes because the Flatpak still misses two core Limux behaviors. --filesystem=host shares project files, but the terminal shell still runs inside the Flatpak runtime without host tools such as git and cargo on PATH (I verified this under GNOME 49). The control socket also stays in Flatpak's private $XDG_RUNTIME_DIR, so a host limux-cli cannot reach the app. Please add and exercise a host shell path and a host-visible control socket before merging. The three pane action SVGs noted in my earlier comment are also still absent. The submodule collision and GNOME runtime issues are fixed; the documented offline Zig and metainfo work still remains before Flathub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants