summary refs log tree commit diff
diff options
context:
space:
mode:
authorRaghav Gururajan <raghavgururajan@disroot.org>2020-09-07 07:04:15 -0400
committerDanny Milosavljevic <dannym@scratchpost.org>2020-09-07 13:54:32 +0200
commit04963d4ca16f28a23b0b387f2703a2b7a859a19d (patch)
tree8257926535fd0de5621d932a62ef42c4ffac37db
parent1349564dae59c5d5d7480efe785f11798631986b (diff)
downloadguix-04963d4ca16f28a23b0b387f2703a2b7a859a19d.tar.gz
gnu: gdm: Fix some run-time issues.
* gnu/packages/gnome.scm (gdm) [arguments]<#:phases>['install-placeholder-desktop-entry]: New phase.
['link-autostart-files]: New phase.

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
-rw-r--r--gnu/packages/gnome.scm43
1 files changed, 42 insertions, 1 deletions
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index a1b8b27c60..410cc92d40 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -9500,7 +9500,48 @@ libxml2.")
                               "g_strcmp0(base_name, \"fail.desktop\") == 0)"))
               (("g_error [(]\"GdmSession: no session desktop files installed, aborting\\.\\.\\.\"[)];")
                "{ self->fallback_session_name = g_strdup(\"fail\"); goto out; }"))
-             #t)))))
+             #t))
+         ;; GDM requires that there be at least one desktop entry
+         ;; file.  This phase installs a hidden one that simply
+         ;; fails.  This enables users to use GDM with a
+         ;; '~/.xsession' script with no other desktop entry files.
+         ;; See <https://bugs.gnu.org/35068>.
+         (add-after 'install 'install-placeholder-desktop-entry
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (sessions (string-append out "/share/gdm/BuiltInSessions"))
+                    (fail (string-append sessions "/fail.desktop")))
+               (mkdir-p sessions)
+               (with-output-to-file fail
+                 (lambda ()
+                   (for-each
+                    display
+                    '("[Desktop Entry]\n"
+                      "Encoding=UTF-8\n"
+                      "Type=Application\n"
+                      "Name=Fail\n"
+                      "Comment=This session fails immediately.\n"
+                      "NoDisplay=true\n"
+                      "Exec=false\n"))))
+               #t)))
+         ;; GDM needs GNOME Session to run these applications.  We link
+         ;; their autostart files in `share/gdm/greeter/autostart'
+         ;; because GDM explicitly tells GNOME Session to look there.
+         ;;
+         ;; XXX: GNOME Shell should be linked here too, but currently
+         ;; GNOME Shell depends on GDM.
+         (add-after 'install 'link-autostart-files
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (autostart (string-append out "/share/gdm/"
+                                              "greeter/autostart"))
+                    (settings (assoc-ref inputs "gnome-settings-daemon")))
+               (mkdir-p autostart)
+               (with-directory-excursion autostart
+                 (for-each (lambda (desktop)
+                             (symlink desktop (basename desktop)))
+                           (find-files (string-append settings "/etc/xdg"))))
+               #t))))))
     (native-inputs
      `(("check" ,check)
        ("dconf" ,dconf)