-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flatpak #33371
Flatpak #33371
Conversation
When running
|
Weird, if I run There is also another message from
Edit: Upstream bug: https://gitlab.gnome.org/GNOME/gnome-photos/issues/51 |
I used to be able to run flatpak flawlessly with your commits (not sure whether there was an update to them since, I usually just use current trunk with some cherry-picked commits, like yours) but for quite some time now I only get |
@Mounium Sorry about that, I switched from the vendored bubblewrap to the one in Nix and did not check if it works. (I though bubblewrap is used as a library, which would be linked correctly, but it uses the |
I have been using it in the last couple of days, most flatpak packages work just fine, awesome work 👍 One strange package, pulseeffects doesn't seem to work, or at least not in a stable manner (wwmm/easyeffects#156), as I can get it to work from within the gnome software center, but not from command line, probably due to some environment variable set by the wrapper script on gnome-software. |
I tested the portals with https://github.com/matthiasclasen/portal-test (follow the changes in pull requests) and now they work. The last remaining thing is adding an automated test. I created a prototype but the Test prototype--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -255,6 +255,7 @@
tests.env = callTest tests/env.nix {};
tests.ferm = callTest tests/ferm.nix {};
tests.firefox = callTest tests/firefox.nix {};
+ tests.flatpak = callTest tests/flatpak.nix {};
tests.firewall = callTest tests/firewall.nix {};
tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {};
#tests.gitlab = callTest tests/gitlab.nix {};
--- /dev/null
+++ b/nixos/tests/flatpak-portal-test.patch
@@ -0,0 +1,42 @@
+--- a/flatpak/build.sh
++++ b/flatpak/build.sh
+@@ -1,3 +1,3 @@
+ #!/bin/sh
+
+-flatpak-builder --force-clean --ccache --require-changes --repo=repo app org.gnome.PortalTest.json
++flatpak-builder --force-clean --require-changes --repo=repo app org.gnome.PortalTest.json
+--- a/flatpak/org.gnome.PortalTest.json
++++ b/flatpak/org.gnome.PortalTest.json
+@@ -10,23 +10,6 @@
+ "--socket=pulseaudio"
+ ],
+ "modules": [
+- {
+- "name": "meson",
+- "no-autogen": true,
+- "cleanup": [ "/bin", "/lib" ],
+- "sources": [
+- {
+- "type": "archive",
+- "url": "https://github.com/mesonbuild/meson/releases/download/0.36.0/meson-0.36.0.tar.gz",
+- "sha256": "dc087ec40dacb5e256e6ee6467f2d004faf4ef284d3c1ce5e89faa1e16540950"
+- },
+- {
+- "type": "file",
+- "path": "meson-makefile",
+- "dest-filename": "Makefile"
+- }
+- ]
+- },
+ {
+ "name": "portal-test",
+ "buildsystem": "meson",
+@@ -34,7 +17,7 @@
+ "sources": [
+ {
+ "type": "git",
+- "url": "https://github.com/matthiasclasen/permission-viewer.git"
++ "url": ".."
+ }
+ ]
+ }
--- /dev/null
+++ b/nixos/tests/flatpak.nix
@@ -0,0 +1,48 @@
+import ./make-test.nix ({ pkgs, ... }:
+
+let
+ portal-test = with pkgs; stdenv.mkDerivation {
+ name = "portal-test";
+ src = fetchFromGitHub {
+ owner = "matthiasclasen";
+ repo = "portal-test";
+ rev = "a2468457cee72b86be51d8a0ee5911c37d6894c2";
+ sha256 = "00c7wcjawh80f9vfqm187hmv325ghl9c6r620iq4bf7q4sqj1ab6";
+ };
+ phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ];
+ patches = [ ./flatpak-portal-test.patch ];
+ buildInputs = [ flatpak-builder gitMinimal libdwarf ];
+ buildPhase = ''
+ cd flatpak
+ ./build.sh
+ '';
+ installPhase = ''
+ cp -r repo $out/repo
+ '';
+ };
+in {
+ name = "flatpak";
+ meta = {
+ maintainers = pkgs.flatpak.meta.maintainers;
+ };
+
+ machine =
+ { config, pkgs, ... }:
+
+ {
+ imports = [ ./common/x11.nix ];
+ services.flatpak.enable = true;
+ };
+
+ testScript =
+ ''
+ $machine->waitForX;
+ $machine->execute("flatpak remote-add --user --no-gpg-verify portal-test ${portal-test}/repo");
+ $machine->execute("flatpak install --user portal-test org.gnome.PortalTest");
+ $machine->execute("flatpak run org.gnome.PortalTest");
+ $machine->waitForWindow(qr/Portal Test/);
+ $machine->succeed("xwininfo -root -tree | grep 'Portal Test'");
+ $machine->screenshot("screen");
+ '';
+
+}) Sources: |
32f36fc
to
8d31005
Compare
Since the last time, I tried switching to installed tests which look more promising than the test prototype. Unfortunately, they try to create a runtime by copying files from |
There is also |
More path patching and adding some dependencies fixed most of the tests:
The seven remaining tests depend on generating a platform, which I did by copying a Nix store closure to the export |
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
When a package contains a directory in one of the systemd directories (like flatpak does), it is symlinked into the *-units derivation. Then later, the derivation will try to create the directory, which will fail: mkdir: cannot create directory '/nix/store/…-user-units/dbus.service.d': File exists builder for '/nix/store/…-user-units.drv' failed with exit code 1 Closes: NixOS#33233
Success on aarch64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
nixos/tests/flatpak.nix
Outdated
services.xserver.desktopManager.gnome3.enable = true; # TODO: figure out minimal environment where the tests work | ||
services.flatpak.enable = true; | ||
environment.systemPackages = with pkgs; [ gnupg gnome-desktop-testing ostree python2 ]; | ||
virtualisation.memorySize = 2048; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want the test to run on i686, this should be 2047 due to a memory limitation in qemu-system-i386
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: flatpak, flatpak-builder, gnome3.gnome-software, xdg-desktop-portal, xdg-desktop-portal-gtk Partial log (click to expand)
|
It'd be nice if users could use Flatpak too. As it is now, any operations having to do with Flatpak have to be done as root making Flatpak support a non-start for me.
|
Have you tried to supply the |
On NixOS i am using |
@hedning, the |
Motivation for this change
Allows running sandboxed applications.
Closes: #32807
How to test
Enable the service by adding
services.flatpak.enable = true;
to yourconfiguration.nix
Things done
Installing and running applications works,
we still need to check whether all the portals and interactions work.Portals work as well.build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)