Skip to content

Instantly share code, notes, and snippets.

@jspaleta
Created January 22, 2026 05:03
Show Gist options
  • Select an option

  • Save jspaleta/1b36a3ec22bef4a5b830c3eb698b17b0 to your computer and use it in GitHub Desktop.

Select an option

Save jspaleta/1b36a3ec22bef4a5b830c3eb698b17b0 to your computer and use it in GitHub Desktop.
Local Flatpak repo tests
# First let's follow the hello world flatpak tutorial
# https://docs.flatpak.org/en/latest/first-build.html
# Create flatpak-test-repo in location you can write to:
$ export REPO_BASE=${HOME}/scratch/
$ mkdir -p ${REPO_BASE}/flatpak-test-repo
# create a directory to hold test flatpak applications
$ mkdir -p ${HOME}/scratch/flatpak-test/org.flatpak.Hello1
# Lets make the first test app
$ cd ${HOME}/scratch/flatpak-test/org.flatpak.Hello1
# create file: org.flatpak.Hello1.yml
$ cat << EOF > org.flatpak.Hello1.yml
id: org.flatpak.Hello1
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
command: hello
modules:
- name: hello
buildsystem: simple
build-commands:
- install -Dm755 hello.sh /app/bin/hello
sources:
- type: script
dest-filename: hello.sh
commands:
- echo "Hello world, from a sandbox"
EOF
# build the flatpak and export to the local remote
$ flatpak-builder --force-clean --user --repo=${REPO_BASE}/flatpak-test-repo builddir org.flatpak.Hello1.yml
# Lets make the second test app
$ cd ${HOME}/scratch/flatpak-test/org.flatpak.Hello2
# create file: org.flatpak.Hello2.yml
$ cat << EOF > org.flatpak.Hello2.yml
id: org.flatpak.Hello2
runtime: org.freedesktop.Platform
runtime-version: '25.08'
sdk: org.freedesktop.Sdk
command: hello
modules:
- name: hello
buildsystem: simple
build-commands:
- install -Dm755 hello.sh /app/bin/hello
sources:
- type: script
dest-filename: hello.sh
commands:
- echo "Hello world, from a sandbox"
EOF
# build the flatpak and export to the local remote
$ flatpak-builder --force-clean --user --repo=${REPO_BASE}/flatpak-test-repo builddir org.flatpak.Hello2.yml
# Check the contents of the local remote
$ flatpak remote-ls file://${REPO_BASE}/flatpak-test-repo --columns=name,application,commit,ref,origin,arch
# Note the commit UUIDs
# rebuild the flatpaks and export to the local remote by repeating the flatpak-builder commands above
# check the contents of the local remote directory and check to see the commit UUID has changed
# This confirms you are able to update the local remote with update builds
# Add the local remote unfiltered to the systemwide session
$ flatpak remote-add --system --no-gpg-verify local-unfiltered ${REPO_BASE}/flatpak-test-repo
# Check the contents of the installed systemwide remote
$ flatpak remote-ls --system local-unfiltered --columns=name,application,commit,ref,origin,arch
# Note the commit UUID, should be the same as the local repo directory
# Check with remote-info and see the history of commits into the local repo
$ flatpak remote-info --log local-unfiltered org.flatpak.Hello1
$ flatpak remote-info --log local-unfiltered org.flatpak.Hello2
# Let's now create the filter that allows Hello1 but denies Hello2
$ cat << EOF > ${HOME}/scratch/local-remote-filter
# Allowlist style filter
deny *
# Allow Hello1
allow app/org.flatpak.Hello1
EOF
# Let's create the filtered systemwide local remote
$ flatpak remote-add --system --no-gpg-verify --filter ${HOME}/scratch/local-remote-filter local-filtered ${REPO_BASE}/flatpak-test-repo
# Make sure the install works as expected for both
# For Hello1 you should offer both local-filtered and local-unfilters as options
# install from filtered
$ flatpak install org.flatpak.Hello1
# For Hello2 you should only see local-unfiltered
$ flatpak install org.flatpak.Hello2
# check
$ flatpak list |grep Hello
# should see something like this:
Hello1 org.flatpak.Hello1 master local-filtered system
Hello2 org.flatpak.Hello2 master local-unfiltered system
# If you update both apps using the flatpak-builder commands again, flatpak update should update.
$ flatpak update org.flatpak.Hello1
$ flatpak update org.flatpak.Hello2
# This ends baseline setup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment