Declarative Flatpak app list for immutable Linux distros: installs missing apps, reports drift, multi-remote with per-app pinning.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-01 15:13:32 +01:00
.gitignore Release v1.0.0 2026-11-01 15:13:32 +01:00
flatpaks.example.txt Release v1.0.0 2026-11-01 15:10:00 +01:00
LICENSE Release v1.0.0 2026-11-01 15:10:00 +01:00
main.sh Release v1.0.0 2026-11-01 15:10:00 +01:00
README.md Release v1.0.0 2026-11-01 15:10:00 +01:00

flatpak state

Declarative Flatpak app list for atomic / immutable Linux distros (Fedora Atomic, Bazzite, Bluefin, ...). Keeps flatpaks.txt and the system in sync.

Features

  • Installs missing apps from the list, one at a time; failures print a diagnosis and the full Flatpak output, the run continues, exit code is non-zero at the end
  • Multi-remote: tries remotes in priority order (flathub, plus fedora on Fedora-based systems); fallback only on "Nothing matches"
  • Per-app remote pinning: fedora:org.videolan.vlc
  • Never touches installed apps, regardless of their origin
  • Reports apps missing from the list: remove (with confirmation) / add / ignore
  • Creates the list from installed apps if it does not exist
  • Idempotent; colored, compact output

Requirements

bash >= 4, flatpak, sort, tail. Optional: flock (single-instance lock), timeout (install timeout). Run on the host, not in toolbox/distrobox (flatpak-spawn --host ./main.sh).

List format

One app ID per line, # starts a comment. Blank lines, CRLF and edge whitespace are ignored; invalid IDs and duplicates are skipped with a warning (with line number).

com.brave.Browser
org.videolan.VLC               # flathub ID is case-sensitive
fedora:org.videolan.vlc        # pinned to the fedora remote

Usage

./main.sh [options]
Option Description
-f, --file PATH List file (default: flatpaks.txt next to the script)
-n, --dry-run Show what would happen, change nothing
-v, --verbose Also list already installed apps
-u, --update Run flatpak update at the end
--user / --system Select installation scope
-y, --no-prompt Never ask, only report extra apps
-h, --help Show help

Environment

CLI options > environment > defaults.

Variable Default Description
FLATSYNC_LIST flatpaks.txt next to script List path
FLATSYNC_REMOTE flathub Primary remote (added if missing)
FLATSYNC_REMOTE_URL Flathub .flatpakrepo Primary remote URL, https only
FLATSYNC_REMOTES flathub [+ fedora] Remotes in priority order
FLATSYNC_SCOPE flatpak default user or system
FLATSYNC_TIMEOUT 30m Per-install timeout
FLATSYNC_UPDATE=1 Same as --update
FLATSYNC_NO_PROMPT=1 Same as --no-prompt
FLATSYNC_COLOR auto auto, always, never (NO_COLOR honored)

How it works

  1. Config + pre-flight: validates env and CLI, checks dependencies, list file, lock, signal traps.
  2. Parse: creates the list if missing, then reads and validates it.
  3. State: ensures the primary remote exists, resolves usable remotes, takes one snapshot of installed apps.
  4. Install: missing apps one by one from the pinned or first matching remote.
  5. Drift: installed apps not in the list are offered for [r]emove / [a]dd / [i]gnore / [q]uit (ignore is not persisted). Non-interactive runs only list them.
  6. Summary: installed / up-to-date / failed / extra, per-remote breakdown if sources are mixed.

Exit codes

Code Meaning
0 Success
1 One or more installs failed
2 Environment or argument error
129 / 130 / 143 HUP / INT / TERM

Notes

  • Removing an app keeps its data in ~/.var/app/; clean runtimes with flatpak uninstall --unused.
  • Automation: ./main.sh -y from chezmoi (run_onchange_), a systemd user unit, or ujust.
  • Lint: bash -n main.sh && shellcheck main.sh.

License

GPL-3.0-or-later, see LICENSE


Primary repository: https://code.nolog.cz/hindrich/flatpak-state. The GitHub repository is a read-only mirror; please open issues and pull requests on code.nolog.cz.