Flatpak: Difference between revisions

imported>Onny
mNo edit summary
imported>Onny
Add development example
Line 9: Line 9:


If you'd rather make flatpak available on a specific user rather than globally, add <code>flatpak</code> to that user's packages. To be able to install flatpaks graphically, add the <code>gnome.gnome-software</code> package. The result will look something like this:
If you'd rather make flatpak available on a specific user rather than globally, add <code>flatpak</code> to that user's packages. To be able to install flatpaks graphically, add the <code>gnome.gnome-software</code> package. The result will look something like this:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
   users.users.myflatpakuser = {
   users.users.myflatpakuser = {
Line 25: Line 26:
</nowiki>}}
</nowiki>}}
This is also required when installing <code>flatpak</code> on a per-user basis.
This is also required when installing <code>flatpak</code> on a per-user basis.


To start using flatpaks, particularly for flatpak development:
To start using flatpaks, particularly for flatpak development:
Line 35: Line 35:
flatpak install flathub org.freedesktop.Bustle
flatpak install flathub org.freedesktop.Bustle
flatpak run org.freedesktop.Bustle
flatpak run org.freedesktop.Bustle
</syntaxHighlight>
== Development ==
=== Build 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 run it. First install <code>flatpak</code> and <code>flatpak-builder</code> on your system
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.flatpak.enable = true;
environment.systemPackages = [ pkgs.flatpak-builder ];
</nowiki>}}
Clone, build and run the example project
<syntaxHighlight>
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatp
akrepo
flatpak install org.gnome.Sdk/x86_64/master org.gnome.Platform/x86_64/master
git clone https://gitlab.gnome.org/GNOME/libhandy.git
cd libhandy
flatpak-builder --user --install _flatpak examples/sm.puri.Handy.Demo.json
flatpak run sm.puri.Handy.Demo
</syntaxHighlight>
</syntaxHighlight>