From 620e32643468da6318dde6491b0a2ff74608d435 Mon Sep 17 00:00:00 2001
From: ng0
Date: Fri, 29 Sep 2017 10:06:51 +0000
Subject: [PATCH 21/21] gnu: services: Add MATE desktop service.
* gnu/services/desktop.scm (,
mate-desktop-service-type): New variable.
(mate-desktop-service): New public variable.
* doc/guix.texi (Desktop Services): Document the service.
---
doc/guix.texi | 26 +++++++++++++++++++-------
gnu/services/desktop.scm | 45 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 7 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index c10fc649d..56187d1bc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -26,7 +26,7 @@ Copyright @copyright{} 2016 Ben address@hidden
Copyright @copyright{} 2016 Chris address@hidden
Copyright @copyright{} 2016, 2017 Efraim address@hidden
Copyright @copyright{} 2016 John address@hidden
-Copyright @copyright{} 2016 address@hidden
+Copyright @copyright{} 2016, 2017 address@hidden
Copyright @copyright{} 2016, 2017 Jan address@hidden
Copyright @copyright{} 2016 Julien address@hidden
Copyright @copyright{} 2016 Alex ter address@hidden
@@ -11781,7 +11781,7 @@ The @code{(gnu services desktop)} module provides services that are
usually useful in the context of a ``desktop'' setup---that is, on a
machine running a graphical display server, possibly with graphical user
interfaces, etc. It also defines services that provide specific desktop
-environments like GNOME and XFCE.
+environments like GNOME, XFCE or MATE.
To simplify things, the module defines a variable containing the set of
services that users typically expect on a machine with a graphical
@@ -11806,9 +11806,10 @@ The @var{%desktop-services} variable can be used as the @code{services}
field of an @code{operating-system} declaration (@pxref{operating-system
Reference, @code{services}}).
-Additionally, the @code{gnome-desktop-service} and
address@hidden procedures can add GNOME and/or XFCE to a
-system. To ``add GNOME'' means that system-level services like the
+Additionally, the @code{gnome-desktop-service},
address@hidden and @code{mate-desktop-service}
+procedures can add GNOME, XFCE and/or MATE to a system.
+To ``add GNOME'' means that system-level services like the
backlight adjustment helpers and the power management utilities are
added to the system, extending @code{polkit} and @code{dbus}
appropriately, allowing GNOME to operate with elevated privileges on a
@@ -11819,6 +11820,11 @@ not only adds the @code{xfce} metapackage to the system profile, but it
also gives the Thunar file manager the ability to open a ``root-mode''
file management window, if the user authenticates using the
administrator's password via the standard polkit graphical interface.
+To ``add MATE'' means that @code{polkit} and @code{dbus} are extended
+appropriately, allowing MATE to operate with elevated privileges on a
+limited number of special-purpose system interfaces. Additionally,
+adding a service made by @code{mate-desktop-service} adds the MATE
+metapackage to the system profile.
@deffn {Scheme Procedure} gnome-desktop-service
Return a service that adds the @code{gnome} package to the system
@@ -11833,9 +11839,15 @@ file system as root from within a user session, after the user has
authenticated with the administrator's password.
@end deffn
-Because the GNOME and XFCE desktop services pull in so many packages,
address@hidden {Scheme Procedure} mate-desktop-service
+Return a service that adds the @code{mate} package to the system
+profile, and extends polkit with the actions from
address@hidden
address@hidden deffn
+
+Because the GNOME, XFCE and MATE desktop services pull in so many packages,
the default @code{%desktop-services} variable doesn't include either of
-them by default. To add GNOME or XFCE, just @code{cons} them onto
+them by default. To add GNOME, XFCE orMATE, just @code{cons} them onto
@code{%desktop-services} in the @code{services} field of your
@code{operating-system}:
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 527a3101c..3c6a18125 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2015 Mark H Weaver
;;; Copyright © 2016 Sou Bunnbu
;;; Copyright © 2017 Maxim Cournoyer
+;;; Copyright © 2017 ng0
;;;
;;; This file is part of GNU Guix.
;;;
@@ -42,6 +43,7 @@
#:use-module (gnu packages suckless)
#:use-module (gnu packages linux)
#:use-module (gnu packages libusb)
+ #:use-module (gnu packages mate)
#:use-module (guix records)
#:use-module (guix packages)
#:use-module (guix store)
@@ -82,6 +84,11 @@
gnome-desktop-service
gnome-desktop-service-type
+ mate-desktop-configuration
+ mate-desktop-configuration?
+ mate-desktop-service
+ mate-desktop-service-type
+
xfce-desktop-configuration
xfce-desktop-configuration?
xfce-desktop-service
@@ -798,6 +805,44 @@ accountsservice web site} for more information."
and extends polkit with the actions from @code{gnome-settings-daemon}."
(service gnome-desktop-service-type config))
+;; MATE Desktop service.
+
+(define-record-type* mate-desktop-configuration
+ make-mate-desktop-configuration
+ mate-desktop-configuration
+ (mate-package mate-package (default mate))
+ (screensaver-package screensaver-package (default mate-screensaver)))
+
+(define %mate-desktop-pam-services
+ (list (unix-pam-service "mate-screensaver")))
+
+(define mate-desktop-setuid-programs
+ (match-lambda
+ (($ screensaver-package)
+ (list (file-append screensaver-package "/libexec/mate-screensaver-dialog")))))
+
+(define mate-desktop-service-type
+ (service-type
+ (name 'mate-desktop)
+ (extensions
+ (list (service-extension polkit-service-type
+ (compose list
+ (package-direct-input-selector
+ "mate-settings-daemon")
+ mate-package))
+ (service-extension pam-root-service-type
+ (const %mate-desktop-pam-services))
+ (service-extension setuid-program-service-type
+ mate-desktop-setuid-programs)
+ (service-extension profile-service-type
+ (compose list
+ mate-package))))))
+
+(define* (mate-desktop-service #:key (config (mate-desktop-configuration)))
+ "Return a service that adds the @code{mate} package to the system profile,
+and extends polkit with the actions from @code{mate-settings-daemon}."
+ (service mate-desktop-service-type config))
+
;;;
;;; XFCE desktop service.
--
2.14.2