packaging claude desktop for linux with flatpak

packaging claude desktop for linux with flatpak

i wanted to run the official claude desktop application on linux without making the installation depend on a debian-based distribution.

anthropic provides a .deb package for the linux application. my goal was to take that application, put it inside a flatpak, and keep the packaging updated when a new upstream version appears.

this article describes how i adapted an existing project to use the official linux packages, added builds for two architectures, automated the version updates, and configured an oci remote using github pages and github container registry.

note: title image and images below are generated by Gemini

starting with an existing project

there was already a claude desktop flatpak project by mboman, so i used it as the starting point for a detached fork.

the original build expected application files from a neighboring claude-desktop checkout and downloaded electron separately.

the official linux package gave me a simpler source for the application. it already contains the executable, its electron runtime, the desktop entry, icons, and mime definitions.

i changed the manifest to download that package directly from anthropic and copy the relevant files into the flatpak.

phase 1: repackaging the application

the main configuration lives in: com.anthropic.Claude.yml

the manifest uses freedesktop platform and electron baseapp version 25.08.

app-id: com.anthropic.Claude
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
base: org.electronjs.Electron2.BaseApp
base-version: '25.08'
command: claude-desktop

the application itself comes from an architecture-specific debian package. each source has a fixed url and a sha-256 checksum, so the build uses a specific upstream artifact.

after downloading the package, the build extracts it:

ar x claude-desktop.deb
tar -xf data.tar.xz

the application directory can then be copied into the flatpak:

cp -a usr/lib/claude-desktop /app/lib/claude-desktop

the manifest also installs the upstream desktop entry and icons, together with the mime definitions for .mcpb, .dxt, and .skill files.

the resulting path looks like this:

official claude desktop .deb
          │
          ▼
extract application and desktop integration files
          │
          ▼
install under /app inside the flatpak
          │
          ▼
export repository and create a .flatpak bundle

Gemini_Generated_Image_9h6p9l9h6p9l9h6p.jpg

adapting the launcher

one part of the upstream package needs special handling: the chromium sandbox helper.

the package includes chrome-sandbox, but its setuid setup is unsuitable inside flatpak. the manifest removes that helper and uses zypak from electron baseapp to launch the application.

the launcher looks like this:

export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID"
exec zypak-wrapper /app/lib/claude-desktop/claude-desktop \
    --ozone-platform-hint=auto \
    --enable-features=WaylandWindowDecorations "$@"

the manifest grants wayland access and fallback x11 access. it also allows notifications, tray integration, and access to the desktop keyring for storing sign-in credentials.

i kept home directory access for project folders and file attachments. this is a broad permission, and it is visible in the manifest:

- --filesystem=home

tools launched by the application still run inside the flatpak environment. an mcp server that expects a command installed on the host may need additional setup to make that command available in the sandbox.

phase 2: making the build repeatable

i reduced the local build to one script:

./build.sh

it enables the user-level flathub remote, installs the required build dependencies, and runs:

flatpak-builder --user --install-deps-from=flathub --force-clean \
    --repo=repo build-dir com.anthropic.Claude.yml

flatpak build-bundle repo claude-desktop.flatpak com.anthropic.Claude

the output is a claude-desktop.flatpak bundle. it can be installed for the current user:

flatpak install --user claude-desktop.flatpak

and launched from the application menu or the terminal:

flatpak run com.anthropic.Claude

the manifest has separate sources for x86_64 and aarch64. each source is restricted to its matching architecture with only-arches.

i added a github actions matrix with one runner for each architecture. both jobs use the same manifest and produce architecture-specific bundles.

phase 3: following upstream releases

pinning the package url makes the build predictable, but it also means someone needs to update the manifest when anthropic publishes a new release.

i already had a small update workflow in my ghost docker project. it runs a shell script on a schedule, checks whether anything changed, and commits the updated version.

i used the same approach here.

the updater is called:

./update.sh

anthropic's stable apt repository provides a Packages index for each architecture. those indexes contain the version, package filename, and sha-256 checksum, so the script can read the values directly.

the script downloads both indexes, validates the relevant fields, and selects the newest numeric version available for both architectures.

waiting for both matters. if the amd64 package appears before the arm64 package, the updater keeps the current version until a common newer release is available. it also keeps the current version if the indexes only contain older releases.

when a newer version is available, the script prepares three changes:

  1. update both package urls and checksums in the manifest
  2. add an appstream release entry, keeping the previous entries
  3. update the packaged version mentioned in the readme

the appstream entry uses the date when the update is detected.

all edits are prepared in temporary files before the script copies them into the checkout. if a required field is invalid or the expected metadata cannot be found, it exits before replacing the project files.

connecting the update and build workflows

the update workflow is scheduled for midnight utc every day:

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'

after the script finishes, it writes the detected version and the number of changed files to GITHUB_OUTPUT. the workflow uses those outputs to decide whether to create a commit.

if there is no newer version, there is no commit.

one github actions detail needs an extra step here. a push made with the built-in GITHUB_TOKEN does not trigger another push workflow. github documents this behavior in its workflow triggering documentation.

so after pushing the update commit, the workflow explicitly starts the build:

gh workflow run build.yml --ref main

the update workflow has permission to write repository contents and dispatch actions. repository rules also need to allow the bot to push to main.

Gemini_Generated_Image_46vj6i46vj6i46vj.jpg

phase 4: publishing a flatpak remote

the bundles cover a local installation, but users would still need to download a new bundle for each release. i wanted the published builds to be available through the normal flatpak update command.

the proton flatpak project by gasinvein already had a useful approach for this. it stores the application images in a container registry and uses github pages to serve a small discovery index.

i adapted that workflow to use github container registry, or ghcr, for the images.

after building each architecture, the workflow exports an oci image. for x86_64, the command looks like this:

flatpak build-bundle --oci --arch=x86_64 \
    --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
    repo oci com.anthropic.Claude master

the publish job waits for both architectures to finish. it then uses skopeo to push the images to:

ghcr.io/mainnika/claude-desktop-flatpak

each image gets a tag containing the git commit and its architecture. the discovery index references the image digests, so a client can request the exact image described by that index.

understanding the remote

github pages only serves two small files:

index/static
claude-desktop.flatpakrepo

index/static is a json catalog containing the registry address and the metadata for both images. the .flatpakrepo file describes the remote so users can add it without typing the oci url manually.

when flatpak reads the catalog, it finds the entry for the machine's architecture and downloads the application layers from ghcr. the application data stays in the registry.

Gemini_Generated_Image_5chx5m5chx5m5chx.jpg

the index is deployed only after both images have been published. if either build or image upload fails, clients keep using the previous catalog. the workflow also serializes builds for main so an older build cannot publish its catalog after a newer one.

pull requests still build the application, but publishing is restricted to main.

enabling the publication

the first publication needs two repository settings.

first, select github actions as the publishing source under settings → pages. then run the build workflow on main.

after the workflow creates the container package, change its visibility to public in github packages. new ghcr packages default to private, and flatpak clients need to download these images without github credentials.

the workflow uses the built-in GITHUB_TOKEN to push the images and deploy the catalog. it does not need a separate container registry password.

once publishing is enabled and the package is public, the remote can be added with:

flatpak remote-add --user --if-not-exists flathub \
    https://flathub.org/repo/flathub.flatpakrepo

flatpak remote-add --user --if-not-exists claude-desktop \
    oci+https://mainnika.github.io/claude-desktop-flatpak/

flatpak install --user claude-desktop com.anthropic.Claude

the remote selects the matching architecture automatically.

final result

the project now has a local build script, builds for both architectures, a daily upstream check, and a workflow for publishing an oci remote.

when a common newer release is available, the updater changes the pinned package metadata, commits it, and starts the build workflow. after both builds and image uploads succeed, the publishing job deploys the new catalog to github pages.

installations using the published remote can then receive the new version with:

flatpak update --user com.anthropic.Claude

local bundles are still available for installing the application directly.

the fork is available at mainnika/claude-desktop-flatpak.