* [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils.
@ 2022-12-04 22:15 John Kehayias via Guix-patches via
2022-12-14 10:00 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2022-12-04 22:15 UTC (permalink / raw)
To: 59825
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]
Hi Guix,
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:
--8<---------------cut here---------------start------------->8---
guix shell -NC flatpak-xdg-utils --preserve='^DBUS_SESSION_BUS_ADDRESS$' -- xdg-open "<https://guix.gnu.org>"
--8<---------------cut here---------------end--------------->8---
which will open Guix's website on the host side.
I've checked it works, the license (some files LGPL2+ other LGPL2.1+), linted, and styled. I adjusted the description from upstream slightly to indicate it is not just for Flatpak sandboxes.
Thanks!
John
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-flatpak-xdg-utils.patch --]
[-- Type: text/x-patch; name=0001-gnu-Add-flatpak-xdg-utils.patch, Size: 2343 bytes --]
From 8669a7fb0e1b9ba320c6312d7423500a56236edc Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
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.
---
gnu/packages/freedesktop.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 077d56ad3d..073bc1e754 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -2530,6 +2530,40 @@ (define-public snixembed
@end itemize")
(license license:isc)))
+(define-public flatpak-xdg-utils
+ (package
+ (name "flatpak-xdg-utils")
+ (version "1.0.5")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/flatpak/flatpak-xdg-utils")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1q8wsc46fcjm737hz10jvgci5wl9sz8hj9aix2y2zdj11bqib9af"))))
+ (build-system meson-build-system)
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "dbus-run-session" "--" "meson" "test"
+ "--print-errorlogs")))))))
+ (inputs (list glib))
+ (native-inputs (list dbus pkg-config))
+ (synopsis
+ "Simple portal-based commandline tools for use inside sandboxes")
+ (description
+ "This package contains a number of commandline utilities for use inside
+Flatpak sandboxes and other containers, like @command{guix shell --container}.
+They work by talking to portals. Currently, there is flatpak-spawn for
+running commands in sandboxes as well as xdg-open and xdg-email, which are
+compatible with the well-known scripts of the same name.")
+ (home-page "https://github.com/flatpak/flatpak-xdg-utils")
+ (license (list license:lgpl2.0+ license:lgpl2.1+))))
+
(define-public libportal
(package
(name "libportal")
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils.
2022-12-04 22:15 [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils John Kehayias via Guix-patches via
@ 2022-12-14 10:00 ` Ludovic Courtès
2022-12-17 5:54 ` John Kehayias via Guix-patches via
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2022-12-14 10:00 UTC (permalink / raw)
To: John Kehayias; +Cc: 59825
Hi!
John Kehayias <john.kehayias@protonmail.com> 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).
Don’t you need to share /tmp as well? ‘DBUS_SESSION_BUS_ADDRESS’ refers
to a socket in /tmp for me.
> From 8669a7fb0e1b9ba320c6312d7423500a56236edc Mon Sep 17 00:00:00 2001
> From: John Kehayias <john.kehayias@protonmail.com>
> 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?
Apart from that, it LGTM!
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils.
2022-12-14 10:00 ` Ludovic Courtès
@ 2022-12-17 5:54 ` John Kehayias via Guix-patches via
2023-01-03 17:35 ` bug#59825: " John Kehayias via Guix-patches via
0 siblings, 1 reply; 4+ messages in thread
From: John Kehayias via Guix-patches via @ 2022-12-17 5:54 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 59825
Howdy,
On Wed, Dec 14, 2022 at 11:00 AM, Ludovic Courtès wrote:
> Hi!
>
> John Kehayias <john.kehayias@protonmail.com> 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 <john.kehayias@protonmail.com>
>> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-03 17:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-04 22:15 [bug#59825] [PATCH] gnu: Add flatpak-xdg-utils John Kehayias via Guix-patches via
2022-12-14 10:00 ` Ludovic Courtès
2022-12-17 5:54 ` John Kehayias via Guix-patches via
2023-01-03 17:35 ` bug#59825: " John Kehayias via Guix-patches via
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.