Subject: [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils.

From: John Kehayias <[email-masked]>
Date: Sat, 17 Dec 2022 05:54:20 +0000

Howdy,

On Wed, Dec 14, 2022 at 11:00 AM, Ludovic Courtès wrote:

> Hi!
>
> John Kehayias <[email-masked]> skribis:
>
>> Here is a little package from the Flatpak folks which is also useful in a guix shell
>> container. This lets you run, for example, xdg-open in the container and it will open on
>> the host side. So let's say you come across a URL, you can just use xdg-open from this
>> package so it will open in the host's web browser, rather than trying in the container.
>> This relies on having portals on the host side, like xdg-desktop-portal-gtk.
>>
>> Here is a simple test example:
>>
>> guix shell -NC flatpak-xdg-utils --preserve='^DBUS_SESSION_BUS_ADDRESS$' -- xdg-open
>> "<https://guix.gnu.org>"
>>
>> which will open Guix's website on the host side.
>
> Interesting (and scary as well, depending on how it’s implemented).
>

Yes, a bit of both! The scary one I think is 'flatpak-spawn' which will run something on the host, but as this is done via portals there's some control there over what it implements and how. I don't know the details though, but I did see checks somewhere for what checking what is allowed to be accessed.

e.g. with guix shell -NC flatpak-xdg-utils --preserve='^DBUS_SESSION_BUS_ADDRESS$' -- flatpak-spawn --host ls /

So yeah, punching holes in a sandbox. Anyway...

> Don’t you need to share /tmp as well?  ‘DBUS_SESSION_BUS_ADDRESS’ refers
> to a socket in /tmp for me.
>

It does point to something in /tmp for me as well, but which doesn't exist...not sure the details of DBus, which I always find confusing.

Note the -N argument, that was key for me to get it working easily. Without that and even sharing /tmp it didn't work, nor if I tried manually adding files that -N adds. So it must be something else about the network option that gets access to the DBus socket?

>> From 8669a7fb0e1b9ba320c6312d7423500a56236edc Mon Sep 17 00:00:00 2001
>> From: John Kehayias <[email-masked]>
>> Date: Sun, 4 Dec 2022 17:06:19 -0500
>> Subject: [PATCH] gnu: Add flatpak-xdg-utils.
>>
>> * gnu/packages/freedesktop.scm (flatpak-xdg-utils): New variable.
>
> <https://qa.guix.gnu.org/issue/59825> mentions a build failure on
> i686-linux; could you take a look?
>

Took me a bit to figure out the logs, but looks like some issue on the build server as in the configure phase I see:

WARNING: Could not create compilation database.

Locally it has built fine, for the same derivation hash as well.

> Apart from that, it LGTM!
>

Great! I'll add it to my early lists of commits I'll make, once I finally get a breather here.

> Thanks,
> Ludo’.

And thank you!

John