Subject: [PATCH] services: Add fontconfig-file-system-service.
From: Efraim Flashner <[email-masked]>
To: [email-masked]
Cc: Efraim Flashner <[email-masked]>
Date: Wed, 18 Mar 2020 12:46:26 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/services/desktop.scm (%fontconfig-file-system,
fontconfig-file-system-service): New variables.
(%desktop-services): Add fontconfig-file-system-service.
---

I've been using a tmpfs mounted read-only at /var/cache/fontconfig for
months now without any problems. This adds it to %desktop-services.

---
 gnu/services/desktop.scm | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 1294d748ac..848ed25e3c 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -5,7 +5,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <[email-masked]>
 ;;; Copyright © 2017 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2017 ng0 <[email-masked]>
-;;; Copyright © 2018 Efraim Flashner <[email-masked]>
+;;; Copyright © 2018, 2020 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2018 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2017, 2019 Christopher Baines <[email-masked]>
 ;;; Copyright © 2019 Tim Gesthuizen <[email-masked]>
@@ -36,7 +36,7 @@
   #:use-module (gnu services networking)
   #:use-module (gnu services sound)
   #:use-module ((gnu system file-systems)
-                #:select (%elogind-file-systems))
+                #:select (%elogind-file-systems file-system))
   #:use-module (gnu system)
   #:use-module (gnu system shadow)
   #:use-module (gnu system pam)
@@ -106,6 +106,8 @@
             elogind-service
             elogind-service-type
 
+            fontconfig-file-system-service
+
             accountsservice-service-type
             accountsservice-service
 
@@ -797,6 +799,25 @@ when they log out."
 
 
 ;;;
+;;; Fontconfig and other desktop file-systems.
+;;;
+
+(define %fontconfig-file-system
+  (file-system
+    (device "none")
+    (mount-point "/var/cache/fontconfig")
+    (type "tmpfs")
+    (flags '(read-only))
+    (check? #f)))
+
+;; The global fontconfig directory is unused in Guix and has been
+;; known to cause problems so we mount it read-only.
+(define fontconfig-file-system-service
+  (simple-service 'fontconfig-file-system
+                  file-system-service-type
+                  (list %fontconfig-file-system)))
+
+;;;
 ;;; AccountsService service.
 ;;;
 
@@ -1185,6 +1206,10 @@ or setting its password with passwd.")))
          ;; perform administrative tasks (similar to "sudo").
          polkit-wheel-service
 
+         ;; The global fontconfig directory is unused in Guix and has been
+         ;; known to cause problems so we mount it read-only.
+         fontconfig-file-system-service
+
          ;; NetworkManager and its applet.
          (service network-manager-service-type)
          (service wpa-supplicant-service-type)    ;needed by NetworkManager
-- 
2.25.1