Flatpak: Difference between revisions

imported from old wiki
Onny (talk | contribs)
Development: Update outdated example
Line 55: Line 55:
=== Build a Flatpak project ===
=== Build a Flatpak project ===


The following example builds a demo project of the [https://gitlab.gnome.org/GNOME/libhandy libhandy] repository using <code>flatpak-builder</code>, installs it locally in the user space and runs it. First install <code>flatpak</code> and <code>flatpak-builder</code> on your system
The following example builds a demo app of the [https://github.com/GNOME/libadwaita libadwaita] repository using <code>flatpak-builder</code>, installs it locally in the user space and runs it. First install <code>flatpak</code> and <code>flatpak-builder</code> on your system


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
Line 62: Line 62:
</nowiki>}}
</nowiki>}}


Clone, build and run the example project. For now, [https://gitlab.gnome.org/GNOME/libhandy/-/merge_requests/844 a patch] for libhandy might be required to fix a bug in the build process.
Clone, build and run the example project.


<syntaxHighlight lang=console>
<syntaxhighlight lang="console">
$ flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
$ flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
$ flatpak install org.gnome.Sdk/x86_64/master org.gnome.Platform/x86_64/master
$ flatpak install gnome-nightly org.gnome.Sdk org.gnome.Platform
$ git clone https://gitlab.gnome.org/GNOME/libhandy.git
$ git clone https://gitlab.gnome.org/GNOME/libadwaita.git
$ cd libhandy
$ cd libadwaita
$ flatpak-builder --user --install _flatpak examples/sm.puri.Handy.Demo.json
$ nix shell nixpkgs#appstream
$ flatpak run sm.puri.Handy.Demo
$ flatpak-builder --disable-tests --user --install build demo/org.gnome.Adwaita1.Demo.json
</syntaxHighlight>
$ flatpak run org.gnome.Adwaita1.Demo.json
</syntaxhighlight>


Note that the <code>gnome-nightly</code> repository and its dependencies are especially required for this specific project and might be different for other Flatpak projects.
Note that the <code>gnome-nightly</code> repository and the <code>appstream</code> dependency are especially required for this specific project and might be different for other Flatpak projects.


== Tips and tricks ==
== Tips and tricks ==