From f9e13323498627218a9aafdc720abfa8c7122ea0 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 26 Jan 2025 00:16:37 +0900 Subject: [PATCH] services/desktop: Use transitively propagated GNOME packages for polkit/udev. This is useful for automatically picking up the polkit or udev rules from the GNOME packages propagated inputs (transitively), e.g. spice-gtk from the gnome-boxes package. * gnu/services/desktop.scm (gnome-profile): Add a #:transitive? argument. (gnome-udev-configuration-files): Use it. (gnome-polkit-settings): Likewise. Change-Id: I3597c9d3dc296e8f3e45017bb02e500db0b73783 Reviewed-by: Liliana Marie Prikler --- gnu/services/desktop.scm | 49 +++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index a0291ea222bdbe7fcd74152995f89b436704dac7..8b17d8be43ffd9021c18056bb2d2cf5d864cf50c 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2015 Andy Wingo ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Sou Bunnbu -;;; Copyright © 2017, 2020, 2022, 2023 Maxim Cournoyer +;;; Copyright © 2017, 2020, 2022, 2023, 2025 Maxim Cournoyer ;;; Copyright © 2017 Nikita ;;; Copyright © 2017, 2019 Hartmut Goebel ;;; Copyright © 2018, 2020, 2022 Efraim Flashner @@ -1547,7 +1547,7 @@ dependencies by filtering out the ignorelist." (union-build #$output (search-path-as-list (list "lib/udev" "libexec/udev") - (list #$@(gnome-profile config))) + (list #$@(gnome-profile config #:transitive? #t))) #:create-all-directories? #t) (for-each (lambda (pattern) @@ -1572,7 +1572,7 @@ rules." (union-build output (search-path-as-list (list "share/polkit-1") - (list #$@(gnome-profile config))) + (list #$@(gnome-profile config #:transitive? #t))) #:create-all-directories? #t) (for-each (lambda (pattern) @@ -1581,21 +1581,34 @@ rules." (find-files output pattern))) (list #$@(gnome-desktop-configuration-polkit-ignorelist config)))))))) -(define (gnome-profile config) - "Return a list of packages propagated through CONFIG." - (append - (gnome-desktop-configuration-core-services config) - (gnome-desktop-configuration-shell config) - (gnome-desktop-configuration-utilities config) - (let ((gnome-meta (gnome-desktop-configuration-gnome config))) - (if (maybe-value-set? gnome-meta) - (begin - (warning - (gnome-desktop-configuration-source-location config) - (G_ "Using a meta-package for gnome-desktop is discouraged.~%")) - (list gnome-meta)) - (list))) - (gnome-desktop-configuration-extra-packages config))) +(define* (gnome-profile config #:key transitive?) + "Return the list of the packages specified in CONFIG. When TRANSITIVE? is +#t, also include their transitive propagated inputs. If there are transitive +inputs using non-default outputs, they are returned as gexp-input objects." + (define gnome-packages + (append + (gnome-desktop-configuration-core-services config) + (gnome-desktop-configuration-shell config) + (gnome-desktop-configuration-utilities config) + (let ((gnome-meta (gnome-desktop-configuration-gnome config))) + (if (maybe-value-set? gnome-meta) + (begin + (warning + (gnome-desktop-configuration-source-location config) + (G_ "Using a meta-package for gnome-desktop is discouraged.~%")) + (list gnome-meta)) + (list))) + (gnome-desktop-configuration-extra-packages config))) + (if transitive? + (append gnome-packages + (append-map (compose (cut map (match-lambda ;discard labels + ((_ pkg) pkg) + ((_ pkg out) + (gexp-input pkg out))) + <>) + package-transitive-propagated-inputs) + gnome-packages)) + gnome-packages)) (define gnome-desktop-service-type (service-type