Subject: [bug#70282] [PATCH v4] gnu: gnome-shell: Wrap screencast service.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 09 May 2024 11:30:21 -0400

Hi Dariqq,

Dariqq <[email-masked]> writes:

[...]

>>> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
>>> index 92e35e3c5a..4bbff2a89b 100644
>>> --- a/gnu/packages/gnome.scm
>>> +++ b/gnu/packages/gnome.scm
>>> @@ -9408,6 +9408,7 @@ (define-public gnome-shell
>>>               (add-after 'install 'wrap-programs
>>>                 (lambda* (#:key inputs #:allow-other-keys)
>>>                   (let ((gi-typelib-path  (getenv "GI_TYPELIB_PATH"))
>>> +                      (gst-plugin-path  (getenv "GST_PLUGIN_SYSTEM_PATH"))
>>>                         (python-path
>>>                          (string-join
>>>                           (filter (lambda (item)
>>> @@ -9427,6 +9428,19 @@ (define-public gnome-shell
>>>                                       "path => imports.gi.GIRepository.Repository."
>>>                                       "prepend_search_path(path));\n"
>>>                                       all)))
>>> +                  ;; Screencast requires a pipewire service running
>>> +                  ;; (i.e. as provided by home-pipewire-service-type)
>>> +                  (substitute* (string-append #$output "/share/gnome-shell/"
>>> +                                              "org.gnome.Shell.Screencast")
>>> +                    (("imports\\.package\\.start" all)
>>> +                     (string-append "'" gi-typelib-path "'.split(':').forEach("
>>> +                                    "path => imports.gi.GIRepository.Repository."
>>> +                                    "prepend_search_path(path));\n"
>>> +                                    "imports.gi.GLib.setenv('GST_PLUGIN_SYSTEM_PATH',"
>>> +                                    "[imports.gi.GLib.getenv('GST_PLUGIN_SYSTEM_PATH'),"
>>> +                                    "'" gst-plugin-path "'].filter(v => v).join(':'),"
>>> +                                    "true);\n"
>>> +                                    all)))
>> Perhaps a simple patch would convey the change better and be easier
>> to
>> maintain in the future / be readily available for other distributions to
>> use.
>
>
> The simple patch that would do this is basically the patch from nixos
> in v1 of this which adds a shebang line for gjs to the service
> invocation files (rather than the dbus service invoking $gjs
> $service). The problem then is that wrap-program changes the filename
> to * .real which makes gjs unhappy.
>
> The people from nix circumvent this by using some js at the beginning
> to reset the entrypoint to the correct value.
>
> One nice way around avoiding the problem would be using wrap-script
> instead though that does not support gjs as interpreter (yet?) and
> adding that forces a rebuild of all packages due to (guix build utils)
> changing.

It'd be nice to prep such support on core-updates.  You can test it on
master by having a (guix build utils-next) module that you explicitly
use.

> Maybe another comment, similiar to the one Liliana suggested earlier
> in this thread, could be added at the beginning to inform about
> changing to wrap script + patch instead once that is a viable option?

That could be a good reminder to have, yes.

-- 
Thanks,
Maxim