#flatpak #desktop #manifest #applications #cargo #generate #package

app cargo-pak

Generate manifest and desktop files for flatpak

2 releases

0.1.2 Apr 3, 2024
0.1.1 Apr 2, 2024

#169 in Cargo plugins

47 downloads per month

GPL-3.0-only

18KB
257 lines

Cargo-pak

the easiest way to package flatpak files

How-to

Create a rust application

cargo new hello-world
fn main() {
    println!("hello world!");
}

Create an app config

This config contains details for both the flatpak manifest and .Desktop file. the following example is for a graphical X11 based application.

app_id="xyz.toastxc.Hello"
app_name= "Hello"
# defined in Cargo.toml (release is performant)
profile="release"

# cargo-pack will default to package name in Cargo.toml
# bin="hello-world"

# definitions: https://docs.flatpak.org/en/latest/sandbox-permissions.html
permissions = [
    "--share=network",
    "--socket=x11",
    "--device=dri"
]

# definitions: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
[desktopfile]
terminal= false

If you want to use a CLI, its a bit more simple

app_id="xyz.toastxc.Hello"
app_name= "Hello"
profile="release"

[desktopfile]
terminal= true

Icons

For the .desktop file icon to work you MUST leave a .png in the root of the directory, identical to the bin name. (e.g. hello-world.png)

Dependencies

~2.2–3MB
~65K SLoC