summary refs log tree commit diff
path: root/gnu/services/desktop.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-17 09:16:17 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-25 14:46:54 -0500
commitabadd0f81f71284ba963084ab17c2e72def3afcd (patch)
tree5ac5e74bf6b3ebec8890a1e94b1e31c2d30e6c86 /gnu/services/desktop.scm
parentacbb112c1b40adb03f3f72c8c8f5bbf2b51c08d6 (diff)
downloadguix-abadd0f81f71284ba963084ab17c2e72def3afcd.tar.gz
services: desktop: Extract a new gnome-package procedure.
* gnu/services/desktop.scm (<gnome-desktop-configuration>): Rename gnome
package accessor to gnome-desktop-configuration-gnome, to avoid name conflict.
(gnome-packages): Change first argument from a config object to a the gnome
package used.  Rename second argument from package to name.  Extract core
logic into...
(gnome-package): ... this.
(gnome-udev-rules, gnome-polkit-settings): Adjust accordingly.
(gnome-desktop-service-type): Likewise.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'gnu/services/desktop.scm')
-rw-r--r--gnu/services/desktop.scm43
1 files changed, 24 insertions, 19 deletions
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 189334dc23..5ddfbb9e53 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -73,6 +73,7 @@
   #:use-module (guix utils)
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
   #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:export (<upower-configuration>
@@ -1347,31 +1348,36 @@ rules.")
 (define-record-type* <gnome-desktop-configuration> gnome-desktop-configuration
   make-gnome-desktop-configuration
   gnome-desktop-configuration?
-  (gnome gnome-package (default gnome)))
+  (gnome gnome-desktop-configuration-gnome
+         (default gnome)))
 
-(define (gnome-packages config packages)
-  "Return the list of GNOME dependencies from CONFIG which names are part of
-the given PACKAGES list."
-  (let ((gnome (gnome-package config)))
-    (map (lambda (name)
-           ((package-direct-input-selector name) gnome))
-         packages)))
+(define (gnome-package gnome name)
+  "Return the package NAME among the GNOME package inputs.  NAME can be a
+single name or a tree-like, e.g. @code{'(\"gnome-boxes\" \"spice-gtk\")} to
+denote the spice-gtk input of the gnome-boxes input of the GNOME meta-package."
+  ((package-direct-input-selector name) gnome))
+
+(define (gnome-packages gnome names)
+  "Return the package NAMES among the GNOME package inputs."
+  (map (cut gnome-package gnome <>) names))
 
 (define (gnome-udev-rules config)
   "Return the list of GNOME dependencies that provide udev rules."
-  (gnome-packages config '("gnome-settings-daemon")))
+  (let ((gnome (gnome-desktop-configuration-gnome config)))
+    (gnome-packages gnome '("gnome-settings-daemon"))))
 
 (define (gnome-polkit-settings config)
   "Return the list of GNOME dependencies that provide polkit actions and
 rules."
-  (gnome-packages config
-                  '("gnome-settings-daemon"
-                    "gnome-control-center"
-                    "gnome-system-monitor"
-                    "gvfs"
-                    ;; spice-gtk provides polkit actions for USB redirection
-                    ;; in GNOME Boxes.
-                    ("gnome-boxes" "spice-gtk"))))
+  (let ((gnome (gnome-desktop-configuration-gnome config)))
+    (gnome-packages gnome
+                    '("gnome-settings-daemon"
+                      "gnome-control-center"
+                      "gnome-system-monitor"
+                      "gvfs"
+                      ;; spice-gtk provides polkit actions for USB redirection
+                      ;; in GNOME Boxes.
+                      ("gnome-boxes" "spice-gtk")))))
 
 (define gnome-desktop-service-type
   (service-type
@@ -1382,8 +1388,7 @@ rules."
           (service-extension polkit-service-type
                              gnome-polkit-settings)
           (service-extension profile-service-type
-                             (compose list
-                                      gnome-package))))
+                             (compose list gnome-desktop-configuration-gnome))))
    (default-value (gnome-desktop-configuration))
    (description "Run the GNOME desktop environment.")))