FLATPAK-BUILD-FINISH(1)
๐ NAME ๐
flatpak-build-finish โ finalize a build directory, bestie. it's the lil glow-up moment before your app goes out into the world ๐
โจ SYNOPSIS โจ
flatpak build-finish [OPTION...] DIRECTORY
๐ฆ DESCRIPTION ๐ฆ
okay so this one finalizes a build directory, meaning it gets it all ready to be exported. DIRECTORY is, obviously, the name of the directory. no mystery there ๐
what you get when it's done: desktop files, icons, D-Bus service files, and AppStream metainfo files from the files subdirectory all get copied over into a shiny new export subdirectory. and in the metadata file, the command key gets set in the [Application] group, while the supported keys in the [Environment] group get set according to whatever options you passed. slay.
finalization is also when you get to declare the permissions your app needs, using all the options below. and heads up: during finalization the permissions from the runtime get inherited into the app, unless you specify --no-inherit-permissions. no cap.
๐ before you go creating and distributing an application bundle, pls pls pls review the exported files and the application metadata. like, actually look at them. ๐
also, real talk: it is an error to run build-finish on a directory that hasn't been initialized as a build directory, or on one that's already been finalized. it's giving "read the room". ๐
๐ OPTIONS ๐
the following options are understood:
-h,--helpโ show help options and exit. short and sweet ๐ซถ--command=COMMANDโ the command to use. if you don't specify this option, the first executable found infiles/binis used.
note that the command is used when the application is run via flatpak run, and it does not affect what gets executed when the application is run in other ways, e.g. via the desktop file or D-Bus activation. so don't be out here thinking it does everything, bestie ๐
--require-version=MAJOR.MINOR.MICROโ require this version or later of flatpak to install/update to this build. gatekeeping, but make it version control ๐--share=SUBSYSTEMโ share a subsystem with the host session. this updates the[Context]group in the metadata.SUBSYSTEMmust be one of:network,ipc. this option can be used multiple times.--unshare=SUBSYSTEMโ don't share a subsystem with the host session. this updates the[Context]group in the metadata.SUBSYSTEMmust be one of:network,ipc. this option can be used multiple times.--share-if=SUBSYSTEM:CONDITIONโ share a subsystem with the host session conditionally, only when the specified condition is met at runtime. this updates the[Context]group in the metadata.SUBSYSTEMmust be one of:network,ipc.CONDITIONmust be one of:true,false,has-input-device,has-wayland,has-usb-device,has-usb-portal. conditions can be negated with!, for example!has-input-device. this option can be used multiple times. available since 1.17. โจ
see the Conditional Permissions section in flatpak-metadata(5) for more details.
--socket=SOCKETโ expose a well-known socket to the application. this updates the[Context]group in the metadata.SOCKETmust be one of:x11,wayland,fallback-x11,pulseaudio,system-bus,session-bus,ssh-auth,pcsc,cups,gpg-agent,inherit-wayland-socket. this option can be used multiple times.
the fallback-x11 option makes the X11 socket available only if there is no Wayland socket. this option was introduced in 0.11.3. to support older Flatpak releases, specify both x11 and fallback-x11. the fallback-x11 option takes precedence when both are supported. iykyk ๐ธ
--nosocket=SOCKETโ don't expose a well known socket to the application. this updates the[Context]group in the metadata.SOCKETmust be one of:x11,wayland,fallback-x11,pulseaudio,system-bus,session-bus,ssh-auth,pcsc,cups,gpg-agent,inherit-wayland-socket. this option can be used multiple times.--socket-if=SOCKET:CONDITIONโ expose a well-known socket to the application conditionally, only when the specified condition is met at runtime. this updates the[Context]group in the metadata.SOCKETmust be one of:x11,wayland,fallback-x11,pulseaudio,system-bus,session-bus,ssh-auth,pcsc,cups,gpg-agent,inherit-wayland-socket.CONDITIONmust be one of:true,false,has-input-device,has-wayland,has-usb-device,has-usb-portal. conditions can be negated with!, for example!has-wayland. this option can be used multiple times. available since 1.17. โญ
see the Conditional Permissions section in flatpak-metadata(5) for more details.
--device=DEVICEโ expose a device to the application. this updates the[Context]group in the metadata.DEVICEmust be one of:dri,input,usb,kvm,shm,all. this option can be used multiple times.--nodevice=DEVICEโ don't expose a device to the application. this updates the[Context]group in the metadata.DEVICEmust be one of:dri,input,usb,kvm,shm,all. this option can be used multiple times.--device-if=DEVICE:CONDITIONโ expose a device to the application conditionally, only when the specified condition is met at runtime. this updates the[Context]group in the metadata.DEVICEmust be one of:dri,input,usb,kvm,shm,all.CONDITIONmust be one of:true,false,has-input-device,has-wayland,has-usb-device,has-usb-portal. conditions can be negated with!, for example!has-input-device. this option can be used multiple times. available since 1.17. ๐ซ
see the Conditional Permissions section in flatpak-metadata(5) for more details.
--allow=FEATUREโ allow access to a specific feature. this updates the[Context]group in the metadata.FEATUREmust be one of:devel,multiarch,bluetooth,canbus,per-app-dev-shm. this option can be used multiple times.
the devel feature allows the application to access certain syscalls such as ptrace(), and perf_event_open().
the multiarch feature allows the application to execute programs compiled for an ABI other than the one supported natively by the system. for example, for the x86_64 architecture, 32-bit x86 binaries will be allowed as well. it's giving "we contain multitudes" ๐ฆ
the bluetooth feature allows the application to use bluetooth (AF_BLUETOOTH) sockets. note, for bluetooth to fully work you must also have network access.
the canbus feature allows the application to use canbus (AF_CAN) sockets. note, for this work you must also have network access.
the per-app-dev-shm feature shares a single instance of /dev/shm between the application, any unrestricted subsandboxes that it creates, and any other instances of the application that are launched while it is running. sharing is caring fr fr ๐ซถ
--disallow=FEATUREโ disallow access to a specific feature. this updates the[Context]group in the metadata.FEATUREmust be one of:devel,multiarch,bluetooth,canbus,per-app-dev-shm. this option can be used multiple times.--allow-if=FEATURE:CONDITIONโ allow access to a specific feature conditionally, only when the specified condition is met at runtime. this updates the[Context]group in the metadata.FEATUREmust be one of:devel,multiarch,bluetooth.CONDITIONmust be one of:true,false,has-input-device,has-wayland,has-usb-device,has-usb-portal. conditions can be negated with!, for example!has-input-device. this option can be used multiple times. available since 1.17. โจ
see the Conditional Permissions section in flatpak-metadata(5) for more details.
--filesystem=FSโ allow the application access to a subset of the filesystem. this updates the[Context]group in the metadata.FScan be one of:home,host,host-os,host-etc,host-root,xdg-desktop,xdg-documents,xdg-download,xdg-music,xdg-pictures,xdg-public-share,xdg-templates,xdg-videos,xdg-run,xdg-config,xdg-cache,xdg-data, an absolute path, or a homedir-relative path like~/dir, or paths relative to the xdg dirs, likexdg-download/subdir. the optional:rosuffix indicates that the location will be read-only. the optional:createsuffix indicates that the location will be read-write and created if it doesn't exist. this option can be used multiple times. see the[Context] filesystemslist inflatpak-metadata(5)for details of the meanings of these filesystems. ๐--nofilesystem=FILESYSTEMโ remove access to the specified subset of the filesystem from the application. this overrides to the Context section from the application metadata.FILESYSTEMcan be one of:home,host,host-os,host-etc,host-root,xdg-desktop,xdg-documents,xdg-download,xdg-music,xdg-pictures,xdg-public-share,xdg-templates,xdg-videos, an absolute path, or a homedir-relative path like~/dir. this option can be used multiple times.--add-policy=SUBSYSTEM.KEY=VALUEโ add generic policy option. for example,"--add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2"would map to this metadata:
[Policy subsystem]
key=v1;v2;
this option can be used multiple times. stacking them like collectibles ๐
--remove-policy=SUBSYSTEM.KEY=VALUEโ remove generic policy option. this option can be used multiple times.--usb=TYPE[:DATA]โ makes USB devices matching the query visible to the USB portal by adding the query to the application metadata. this does not have any effect on the devices exposed in/dev.TYPEmust be one of:all,cls,dev,vnd.allโ match all devices.clsโ a device class and subclass query.DATAmust be in the form ofCLASS:SUBCLASSwhere bothCLASSandSUBCLASSmust valid 2-digit hexadecimal class id numbers. alternatively,SUBCLASSmay be*to match all subclasses.devโ a device product id query.DATAmust be a valid 4-character hexadecimal product id number, for example0a1b. it requires avndfilter in the query.vndโ a device vendor id query.DATAmust be a valid 4-character hexadecimal vendor id number greater than zero, for example0fab.
it is possible to compose multiple device queries together with the + sign, for example --usb=vnd:0123+dev:4567. the dev filter requires a vnd. available since 1.15.11. ๐ฅ
--nousb=TYPE[:DATA]โ hides USB devices matching the query from the USB portal by adding the query to the application metadata. queries hiding devices take precedence over queries making devices visible (see--usb). the syntax is exactly equal to--usb. this does not have any effect on the devices exposed in/dev. available since 1.15.11.--usb-list-file=FILENAMEโ drops USB device queries into the app metadata, reading them from the file FILENAME. The line syntax is exactly the same as--usb. Bonus: if a line starts with!, that query behaves like--nousb. Lines starting with#are ignored like a comment. Heads up bestie โ comments do not get persisted. โจ Available since1.15.11.--usb-list=LISTโ same energy but inline: adds USB device queries to the app metadata from LIST. Syntax is exactly the same as--usb, except queries are separated by;. And if a query starts with!, it works like--nousb. Available since1.15.11. ๐--env=VAR=VALUEโ sets an environment variable inside the app. This updates the[Environment]group in the metadata. It overrides theContextsection from the app metadata. Stack it as many times as you want. ๐ซถ--unset-env=VARโ unsets an environment variable in the app. This updates theunset-environmententry in the[Context]group of the metadata. Also repeatable, go off. ๐ธ--env-fd=FDโ reads environment variables from the file descriptor FD and sets them as if you'd used--env. Use this when you don't want env vars and their values to be visible to other users ๐ (privacy queen behavior).
Each environment variable is in the form VAR=VALUE followed by a zero byte. This is the same format used by env -0 and /proc/*/environ.
--own-name=NAMEโ lets the app own the well known name NAME on the session bus. If NAME ends with.*, it can own all matching names. This updates the[Session Bus Policy]group in the metadata. Repeat as needed. ๐--talk-name=NAMEโ lets the app talk to the well known name NAME on the session bus. If NAME ends with.*, it can talk to all matching names. Updates the[Session Bus Policy]group in the metadata. Repeatable, obviously. ๐ฌ--system-own-name=NAMEโ the system bus version of owning: the app can own the well known name NAME on the system bus. Ends with.*? Then all matching names. Updates the[System Bus Policy]group in the metadata. Multiple times = fine.--system-talk-name=NAMEโ lets the app talk to the well known name NAME on the system bus..*suffix = all matching names. Updates the[System Bus Policy]group in the metadata. Also repeatable. ๐ฅ--persist=FILENAMEโ if the app can't get at the real homedir, this makes the (homedir-relative) path FILENAME a bind mount pointing at the corresponding path in the per-application directory, so that spot can hold persistent data. Updates the[Context]group in the metadata. Repeatable. ๐--runtime=RUNTIME,--sdk=SDKโ swaps the runtime or sdk the app uses to the given partial ref. Whatever parts of the ref you leave out get taken from the old values or from the defaults. No cap.--metadata=GROUP=KEY[=VALUE]โ sets a generic key in the metadata file. Leave the value out and it gets set to"true". Simple as. โจ--extension=NAME=VARIABLE[=VALUE]โ adds extension point info. Peep the docs forflatpak-metadata(5)for the possible values of VARIABLE and VALUE.--remove-extension=NAMEโ removes extension point info. bye bestie ๐--extension-priority=VALUEโ sets the priority (the library override order) of the extension point. Only useful for extensions, iykyk.0is the default, and a higher value means higher priority.--extra-data=NAME:SHA256:DOWNLOAD-SIZE:INSTALL-SIZE:URLโ adds info about extra data uris to the app. These get downloaded and verified by the client when the app is installed, and placed in the/app/extradirectory. You can also supply an/app/bin/apply_extrascript that runs after the files are downloaded. ๐--no-exportsโ don't look for exports in the build. Nope, not doing it.--no-inherit-permissionsโ don't inherit runtime permissions in the app. Setting boundaries, love that.-v,--verboseโ prints debug info while the command is processing. Spill the tea, command. โ--ostree-verboseโ prints OSTree debug info while the command is processing.
๐ EXAMPLES ๐
$ flatpak build-finish /build/my-app --socket=x11 --share=ipc
--usb=vnd:0fd9
Exporting share/applications/gnome-calculator.desktop
Exporting share/dbus-1/services/org.gnome.Calculator.SearchProvider.service
More than one executable
Using gcalccmd as command
Please review the exported files and the metadata
Not the "More than one executable" moment ๐ญ โ it picked gcalccmd as the command for you. Still, go review those exported files and the metadata, fr fr.
$ flatpak build-finish /build/my-app --socket=wayland
--socket-if=x11:!has-wayland --share=ipc
This grants Wayland access unconditionally and X11 access only when not running in a Wayland session โ which lets the application fall back to X11 whenever it needs to. Clever girl behavior, honestly. ๐
๐ SEE ALSO ๐
And that's the whole page bestie ๐ซถ this manual comes from the flatpak project โ page FLATPAK BUILD-FINIS(1), no date shown on the footer, so consider this your timestamp of vibes only. Go finish that build, you absolute icon. โจ๐
๐ฆ where this page comes from
- fedora 44: flatpak 1.18.4-1.fc44 ยท LGPL-2.1-or-later
- fedora 44: flatpak 1.18.4-1.fc44 ยท LGPL-2.1-or-later
- nixpkgs unstable: flatpak 1.18.4
- ubuntu stonking: flatpak 1.18.4-1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms