summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-02-20 17:01:39 +0100
committerMarius Bakke <mbakke@fastmail.com>2019-02-20 17:01:39 +0100
commit2c76e19df4b0b4aa0171f1edd9f240f7b6ba5b84 (patch)
treec2e7a7f27dd9c7e704f2e78655328c903a6934d1 /gnu/services
parente6a668ec7303a71f87e4c9354b1458e555058c63 (diff)
parent78b2eb1ad3dcf05c25e0ee4980c97aa52de03a2d (diff)
downloadguix-2c76e19df4b0b4aa0171f1edd9f240f7b6ba5b84.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/desktop.scm92
-rw-r--r--gnu/services/xorg.scm121
2 files changed, 136 insertions, 77 deletions
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index a93fa3c356..ce63969dc8 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2017, 2019 Christopher Baines <mail@cbaines.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -50,6 +51,7 @@
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages mate)
   #:use-module (gnu packages enlightenment)
+  #:use-module (guix deprecation)
   #:use-module (guix records)
   #:use-module (guix packages)
   #:use-module (guix store)
@@ -57,8 +59,22 @@
   #:use-module (guix gexp)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
-  #:export (upower-configuration
+  #:export (<upower-configuration>
+            upower-configuration
             upower-configuration?
+            upower-configuration-upower
+            upower-configuration-watts-up-pro?
+            upower-configuration-poll-batteries?
+            upower-configuration-ignore-lid?
+            upower-configuration-use-percentage-for-policy?
+            upower-configuration-percentage-low
+            upower-configuration-percentage-critical
+            upower-configuration-percentage-action
+            upower-configuration-time-low
+            upower-configuration-time-critical
+            upower-configuration-time-action
+            upower-configuration-critical-power-action
+
             upower-service
             upower-service-type
 
@@ -174,23 +190,33 @@ is set to @var{value} when the bus daemon launches it."
 ;;; Upower D-Bus service.
 ;;;
 
-;; TODO: Export.
 (define-record-type* <upower-configuration>
   upower-configuration make-upower-configuration
   upower-configuration?
-  (upower        upower-configuration-upower
-                 (default upower))
-  (watts-up-pro? upower-configuration-watts-up-pro?)
-  (poll-batteries? upower-configuration-poll-batteries?)
-  (ignore-lid? upower-configuration-ignore-lid?)
-  (use-percentage-for-policy? upower-configuration-use-percentage-for-policy?)
-  (percentage-low upower-configuration-percentage-low)
-  (percentage-critical upower-configuration-percentage-critical)
-  (percentage-action upower-configuration-percentage-action)
-  (time-low upower-configuration-time-low)
-  (time-critical upower-configuration-time-critical)
-  (time-action upower-configuration-time-action)
-  (critical-power-action upower-configuration-critical-power-action))
+  (upower                     upower-configuration-upower
+                              (default upower))
+  (watts-up-pro?              upower-configuration-watts-up-pro?
+                              (default #f))
+  (poll-batteries?            upower-configuration-poll-batteries?
+                              (default #t))
+  (ignore-lid?                upower-configuration-ignore-lid?
+                              (default #f))
+  (use-percentage-for-policy? upower-configuration-use-percentage-for-policy?
+                              (default #f))
+  (percentage-low             upower-configuration-percentage-low
+                              (default 10))
+  (percentage-critical        upower-configuration-percentage-critical
+                              (default 3))
+  (percentage-action          upower-configuration-percentage-action
+                              (default 2))
+  (time-low                   upower-configuration-time-low
+                              (default 1200))
+  (time-critical              upower-configuration-time-critical
+                              (default 300))
+  (time-action                upower-configuration-time-action
+                              (default 120))
+  (critical-power-action      upower-configuration-critical-power-action
+                              (default 'hybrid-sleep)))
 
 (define* upower-configuration-file
   ;; Return an upower-daemon configuration file.
@@ -248,6 +274,11 @@ is set to @var{value} when the bus daemon launches it."
 (define upower-service-type
   (let ((upower-package (compose list upower-configuration-upower)))
     (service-type (name 'upower)
+                  (description
+                   "Run @command{upowerd}}, a system-wide monitor for power
+consumption and battery levels, with the given configuration settings.  It
+implements the @code{org.freedesktop.UPower} D-Bus interface, and is notably
+used by GNOME.")
                   (extensions
                    (list (service-extension dbus-root-service-type
                                             upower-dbus-service)
@@ -260,20 +291,21 @@ is set to @var{value} when the bus daemon launches it."
 
                          ;; Make the 'upower' command visible.
                          (service-extension profile-service-type
-                                            upower-package))))))
-
-(define* (upower-service #:key (upower upower)
-                         (watts-up-pro? #f)
-                         (poll-batteries? #t)
-                         (ignore-lid? #f)
-                         (use-percentage-for-policy? #f)
-                         (percentage-low 10)
-                         (percentage-critical 3)
-                         (percentage-action 2)
-                         (time-low 1200)
-                         (time-critical 300)
-                         (time-action 120)
-                         (critical-power-action 'hybrid-sleep))
+                                            upower-package)))
+                  (default-value (upower-configuration)))))
+
+(define-deprecated (upower-service #:key (upower upower)
+                                   (watts-up-pro? #f)
+                                   (poll-batteries? #t)
+                                   (ignore-lid? #f)
+                                   (use-percentage-for-policy? #f)
+                                   (percentage-low 10)
+                                   (percentage-critical 3)
+                                   (percentage-action 2)
+                                   (time-low 1200)
+                                   (time-critical 300)
+                                   (time-action 120)
+                                   (critical-power-action 'hybrid-sleep))
   "Return a service that runs @uref{http://upower.freedesktop.org/,
 @command{upowerd}}, a system-wide monitor for power consumption and battery
 levels, with the given configuration settings.  It implements the
@@ -1004,7 +1036,7 @@ as expected.")))
          (service wpa-supplicant-service-type)    ;needed by NetworkManager
          (service avahi-service-type)
          (udisks-service)
-         (upower-service)
+         (service upower-service-type)
          (accountsservice-service)
          (service cups-pk-helper-service-type)
          (colord-service)
diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm
index 1efb275794..f2a3c28c90 100644
--- a/gnu/services/xorg.scm
+++ b/gnu/services/xorg.scm
@@ -2,7 +2,8 @@
 ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
-;;; Copyright © 2018 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2018, 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,7 +29,9 @@
   #:use-module ((gnu packages base) #:select (canonical-package))
   #:use-module (gnu packages guile)
   #:use-module (gnu packages xorg)
+  #:use-module (gnu packages fonts)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages display-managers)
   #:use-module (gnu packages gnustep)
   #:use-module (gnu packages gnome)
@@ -290,7 +293,8 @@ in place of @code{/usr/bin/X}."
                              (configuration-file
                               (xorg-configuration-file #:modules modules
                                                        #:fonts fonts))
-                             (xorg-server xorg-server))
+                             (xorg-server xorg-server)
+                             (xserver-arguments '("-nolisten" "tcp")))
   "Return a @code{startx} script in which @var{modules}, a list of X module
 packages, and @var{fonts}, a list of X font directories, are available.  See
 @code{xorg-wrapper} for more details on the arguments.  The result should be
@@ -303,8 +307,8 @@ used in place of @code{startx}."
   (define exp
     ;; Write a small wrapper around the X server.
     #~(apply execl #$X #$X ;; Second #$X is for argv[0].
-             "-logverbose" "-verbose" "-nolisten" "tcp" "-terminate"
-             (cdr (command-line))))
+             "-logverbose" "-verbose" "-terminate" #$@xserver-arguments
+              (cdr (command-line))))
 
   (program-file "startx" exp))
 
@@ -623,48 +627,59 @@ makes the good ol' XlockMore usable."
          (home-directory "/var/lib/gdm")
          (shell (file-append shadow "/sbin/nologin")))))
 
+(define dbus-daemon-wrapper
+  (program-file "gdm-dbus-wrapper"
+                #~(begin
+                    (setenv "XDG_CONFIG_DIRS"
+                            "/run/current-system/profile/etc/xdg")
+                    (setenv "XDG_DATA_DIRS"
+                            "/run/current-system/profile/share")
+                    (apply execl (string-append #$dbus "/bin/dbus-daemon")
+                           (program-arguments)))))
+
 (define-record-type* <gdm-configuration>
   gdm-configuration make-gdm-configuration
   gdm-configuration?
   (gdm gdm-configuration-gdm (default gdm))
   (allow-empty-passwords? gdm-configuration-allow-empty-passwords? (default #t))
   (auto-login? gdm-configuration-auto-login? (default #f))
+  (dbus-daemon gdm-configuration-dbus-daemon (default dbus-daemon-wrapper))
   (default-user gdm-configuration-default-user (default #f))
+  (gnome-shell-assets gdm-configuration-gnome-shell-assets
+                      (default (list adwaita-icon-theme font-cantarell)))
   (x-server gdm-configuration-x-server
-            (default (xorg-wrapper))))
-
-(define (gdm-etc-service config)
-  (define gdm-configuration-file
-    (mixed-text-file "gdm-custom.conf"
-                     "[daemon]\n"
-                     "#User=gdm\n"
-                     "#Group=gdm\n"
-                     (if (gdm-configuration-auto-login? config)
-                         (string-append
-                          "AutomaticLoginEnable=true\n"
-                          "AutomaticLogin="
-                          (or (gdm-configuration-default-user config)
-                              (error "missing default user for auto-login"))
-                          "\n")
-                         (string-append
-                          "AutomaticLoginEnable=false\n"
-                          "#AutomaticLogin=\n"))
-                     "#TimedLoginEnable=false\n"
-                     "#TimedLogin=\n"
-                     "#TimedLoginDelay=0\n"
-                     "#InitialSetupEnable=true\n"
-                     ;; Enable me once X is working.
-                     "WaylandEnable=false\n"
-                     "\n"
-                     "[debug]\n"
-                     "#Enable=true\n"
-                     "\n"
-                     "[security]\n"
-                     "#DisallowTCP=true\n"
-                     "#AllowRemoteAutoLogin=false\n"))
-  `(("gdm" ,(file-union
-             "gdm"
-             `(("custom.conf" ,gdm-configuration-file))))))
+            (default (xorg-wrapper)))
+  (x-session gdm-configuration-x-session
+             (default (xinitrc))))
+
+(define (gdm-configuration-file config)
+  (mixed-text-file "gdm-custom.conf"
+                   "[daemon]\n"
+                   "#User=gdm\n"
+                   "#Group=gdm\n"
+                   (if (gdm-configuration-auto-login? config)
+                       (string-append
+                        "AutomaticLoginEnable=true\n"
+                        "AutomaticLogin="
+                        (or (gdm-configuration-default-user config)
+                            (error "missing default user for auto-login"))
+                        "\n")
+                       (string-append
+                        "AutomaticLoginEnable=false\n"
+                        "#AutomaticLogin=\n"))
+                   "#TimedLoginEnable=false\n"
+                   "#TimedLogin=\n"
+                   "#TimedLoginDelay=0\n"
+                   "#InitialSetupEnable=true\n"
+                   ;; Enable me once X is working.
+                   "WaylandEnable=false\n"
+                   "\n"
+                   "[debug]\n"
+                   "#Enable=true\n"
+                   "\n"
+                   "[security]\n"
+                   "#DisallowTCP=true\n"
+                   "#AllowRemoteAutoLogin=false\n"))
 
 (define (gdm-pam-service config)
   "Return a PAM service for @command{gdm}."
@@ -698,15 +713,27 @@ makes the good ol' XlockMore usable."
                                           "/bin/gdm"))
                      #:environment-variables
                      (list (string-append
+                            "GDM_CUSTOM_CONF="
+                            #$(gdm-configuration-file config))
+                           (string-append
+                            "GDM_DBUS_DAEMON="
+                            #$(gdm-configuration-dbus-daemon config))
+                           (string-append
                             "GDM_X_SERVER="
                             #$(gdm-configuration-x-server config))
-                           ;; XXX: GDM requires access to a handful of
-                           ;; programs and components from Gnome (gnome-shell,
-                           ;; dbus, and gnome-session among others). The
-                           ;; following variables only work provided Gnome is
-                           ;; installed.
-                           "XDG_DATA_DIRS=/run/current-system/profile/share"
-                           "PATH=/run/current-system/profile/bin"))))
+                           (string-append
+                            "GDM_X_SESSION="
+                            #$(gdm-configuration-x-session config))
+                           (string-append
+                            "XDG_DATA_DIRS="
+                            ((lambda (ls) (string-join ls ":"))
+                             (map (lambda (path)
+                                    (string-append path "/share"))
+                                  ;; XXX: Remove gnome-shell below when GDM
+                                  ;; can depend on GNOME Shell directly.
+                                  (cons #$gnome-shell
+                                        '#$(gdm-configuration-gnome-shell-assets
+                                            config)))))))))
          (stop #~(make-kill-destructor))
          (respawn? #t))))
 
@@ -719,8 +746,8 @@ makes the good ol' XlockMore usable."
                                           (const %gdm-accounts))
                        (service-extension pam-root-service-type
                                           gdm-pam-service)
-                       (service-extension etc-service-type
-                                          gdm-etc-service)
+                       (service-extension profile-service-type
+                                          gdm-configuration-gnome-shell-assets)
                        (service-extension dbus-root-service-type
                                           (compose list
                                                    gdm-configuration-gdm))))