me
/
guix
Archived
1
0
Fork 0

gnu: gdm: Use gexps and new style inputs.

* gnu/packages/gnome.scm (gdm)[phases]: Use gexps.
{pre-configure}: Use search-input-file.
{install-logo}: Likewise, and use #$output.
{install-placeholder-desktop-entry}: use search-input-directory.
{link-autostart-files}: Use this-package-input, $output.
[native-inputs]: Remove labels and sort in lexicographical order.
master
Maxim Cournoyer 2022-08-20 19:48:39 -04:00
parent 97313b9b0c
commit 603a8e729e
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
1 changed files with 161 additions and 166 deletions

View File

@ -8400,185 +8400,180 @@ library.")
"gdm-pass-gdk-pixbuf-loader-env.patch")))) "gdm-pass-gdk-pixbuf-loader-env.patch"))))
(build-system meson-build-system) (build-system meson-build-system)
(arguments (arguments
`(#:glib-or-gtk? #t (list
#:configure-flags #:glib-or-gtk? #t
,#~(list #:configure-flags
"-Dplymouth=disabled" #~(list
"-Dsystemd-journal=false" "-Dplymouth=disabled"
"-Dsystemd-journal=false"
;; Using --with-initial-vt=7 allows GDM to run alongside TTY 1, ;; Using --with-initial-vt=7 allows GDM to run alongside TTY 1,
;; instead of having to replace it (i.e., stopping the mingetty ;; instead of having to replace it (i.e., stopping the mingetty
;; service for TTY 1 before starting GDM). ;; service for TTY 1 before starting GDM).
"-Dinitial-vt=7" "-Dinitial-vt=7"
;; Use elogind instead of systemd. ;; Use elogind instead of systemd.
"-Dlogind-provider=elogind" "-Dlogind-provider=elogind"
"-Dsystemdsystemunitdir=no" "-Dsystemdsystemunitdir=no"
"-Dsystemduserunitdir=no" "-Dsystemduserunitdir=no"
;; Use '/etc/environment' for locale settings instead of the ;; Use '/etc/environment' for locale settings instead of the
;; systemd-specific '/etc/locale.conf'. ;; systemd-specific '/etc/locale.conf'.
"-Dlang-file=/etc/environment" "-Dlang-file=/etc/environment"
(string-append "-Dudev-dir=" #$output "/lib/udev") (string-append "-Dudev-dir=" #$output "/lib/udev")
"--localstatedir=/var" "--localstatedir=/var"
(string-append "-Ddefault-path=" (string-append "-Ddefault-path="
(string-join '("/run/setuid-programs" (string-join '("/run/setuid-programs"
"/run/current-system/profile/bin" "/run/current-system/profile/bin"
"/run/current-system/profile/sbin") "/run/current-system/profile/sbin")
":")) ":"))
;; Put GDM in bindir so that glib-or-gtk-build-system wraps the ;; Put GDM in bindir so that glib-or-gtk-build-system wraps the
;; XDG_DATA_DIRS so that it finds its schemas. ;; XDG_DATA_DIRS so that it finds its schemas.
"--sbindir" (string-append #$output "/bin")) "--sbindir" (string-append #$output "/bin"))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before (add-before 'configure 'pre-configure
'configure 'pre-configure (lambda* (#:key inputs #:allow-other-keys)
(lambda* (#:key inputs outputs #:allow-other-keys) ;; We don't have <systemd/sd-daemon.h>.
;; We don't have <systemd/sd-daemon.h>. (substitute* '("common/gdm-log.c"
(substitute* '("common/gdm-log.c" "daemon/gdm-server.c"
"daemon/gdm-server.c" "daemon/gdm-session-worker.c"
"daemon/gdm-session-worker.c" "daemon/gdm-session-worker-job.c")
"daemon/gdm-session-worker-job.c") (("#include <systemd/sd-daemon\\.h>") ""))
(("#include <systemd/sd-daemon\\.h>") "")) ;; Use elogind for sd-login.
;; Use elogind for sd-login. (substitute* '("common/gdm-common.c"
(substitute* '("common/gdm-common.c" "daemon/gdm-local-display-factory.c"
"daemon/gdm-local-display-factory.c" "daemon/gdm-manager.c"
"daemon/gdm-manager.c" "libgdm/gdm-user-switching.c")
"libgdm/gdm-user-switching.c") (("#include <systemd/sd-login\\.h>")
(("#include <systemd/sd-login\\.h>") "#include <elogind/sd-login.h>"))
"#include <elogind/sd-login.h>")) ;; Look for system-installed sessions in
;; Look for system-installed sessions in ;; /run/current-system/profile/share.
;; /run/current-system/profile/share. (substitute* '("libgdm/gdm-sessions.c"
(substitute* '("libgdm/gdm-sessions.c" "daemon/gdm-session.c"
"daemon/gdm-session.c" "daemon/gdm-display.c"
"daemon/gdm-display.c" "daemon/gdm-launch-environment.c")
"daemon/gdm-launch-environment.c") (("DATADIR \"/x")
(("DATADIR \"/x") "\"/run/current-system/profile/share/x")
"\"/run/current-system/profile/share/x") (("DATADIR \"/wayland")
(("DATADIR \"/wayland") "\"/run/current-system/profile/share/wayland")
"\"/run/current-system/profile/share/wayland") (("DATADIR \"/gnome")
(("DATADIR \"/gnome") "\"/run/current-system/profile/share/gnome"))
"\"/run/current-system/profile/share/gnome")) (let ((propagate '("GDM_CUSTOM_CONF"
(let ((propagate '("GDM_CUSTOM_CONF" "GDM_DBUS_DAEMON"
"GDM_DBUS_DAEMON" "GDM_X_SERVER"
"GDM_X_SERVER" "GDM_X_SESSION"
"GDM_X_SESSION" ;; XXX: Remove this once GNOME Shell is
;; XXX: Remove this once GNOME Shell is ;; a dependency of GDM.
;; a dependency of GDM. "XDG_DATA_DIRS")))
"XDG_DATA_DIRS"))) (substitute* "daemon/gdm-session.c"
(substitute* "daemon/gdm-session.c" (("set_up_session_environment \\(self\\);")
(("set_up_session_environment \\(self\\);") (apply string-append
(apply string-append "set_up_session_environment (self);\n"
"set_up_session_environment (self);\n" (map (lambda (name)
(map (lambda (name) (string-append
(string-append "gdm_session_set_environment_variable "
"gdm_session_set_environment_variable " "(self, \"" name "\","
"(self, \"" name "\"," "g_getenv (\"" name "\"));\n"))
"g_getenv (\"" name "\"));\n")) propagate)))))
propagate))))) ;; Find the configuration file using an environment variable.
;; Find the configuration file using an environment variable. (substitute* '("common/gdm-settings.c")
(substitute* '("common/gdm-settings.c") (("GDM_CUSTOM_CONF")
(("GDM_CUSTOM_CONF") (string-append "(g_getenv(\"GDM_CUSTOM_CONF\") != NULL"
(string-append "(g_getenv(\"GDM_CUSTOM_CONF\") != NULL" " ? g_getenv(\"GDM_CUSTOM_CONF\")"
" ? g_getenv(\"GDM_CUSTOM_CONF\")" " : GDM_CUSTOM_CONF)")))
" : GDM_CUSTOM_CONF)"))) ;; Use service-supplied path to X.
;; Use service-supplied path to X. (substitute* '("daemon/gdm-server.c")
(substitute* '("daemon/gdm-server.c") (("\\(X_SERVER X_SERVER_ARG_FORMAT")
(("\\(X_SERVER X_SERVER_ARG_FORMAT") "(\"%s\" X_SERVER_ARG_FORMAT, g_getenv (\"GDM_X_SERVER\")"))
"(\"%s\" X_SERVER_ARG_FORMAT, g_getenv (\"GDM_X_SERVER\")")) (substitute* '("daemon/gdm-wayland-session.c"
(substitute* '("daemon/gdm-wayland-session.c" "daemon/gdm-x-session.c")
"daemon/gdm-x-session.c") (("\"dbus-daemon\"")
(("\"dbus-daemon\"") "g_getenv (\"GDM_DBUS_DAEMON\")")
"g_getenv (\"GDM_DBUS_DAEMON\")") (("X_SERVER")
(("X_SERVER") "g_getenv (\"GDM_X_SERVER\")")
"g_getenv (\"GDM_X_SERVER\")") (("GDMCONFDIR \"/Xsession\"")
(("GDMCONFDIR \"/Xsession\"") "g_getenv (\"GDM_X_SESSION\")"))
"g_getenv (\"GDM_X_SESSION\")")) ;; Use an absolute path for GNOME Session.
;; Use an absolute path for GNOME Session. (substitute* "daemon/gdm-launch-environment.c"
(substitute* "daemon/gdm-launch-environment.c" (("\"gnome-session\"")
(("\"gnome-session\"") (format #f "~s"
(string-append "\"" (assoc-ref inputs "gnome-session") (search-input-file inputs "bin/gnome-session"))))
"/bin/gnome-session\""))) ;; Do not automatically select the placeholder session.
;; Do not automatically select the placeholder session. (substitute* "daemon/gdm-session.c"
(substitute* "daemon/gdm-session.c" (("!g_str_has_suffix [(]base_name, \"\\.desktop\"[)]")
(("!g_str_has_suffix [(]base_name, \"\\.desktop\"[)]") (string-append "!g_str_has_suffix (base_name, \".desktop\") || "
(string-append "!g_str_has_suffix (base_name, \".desktop\") || " "(g_strcmp0(search_dirs[i], \""
"(g_strcmp0(search_dirs[i], \"" #$output "/share/gdm/BuiltInSessions/"
(assoc-ref outputs "out") "/share/gdm/BuiltInSessions/" "\") == 0 && "
"\") == 0 && " "g_strcmp0(base_name, \"fail.desktop\") == 0)"))
"g_strcmp0(base_name, \"fail.desktop\") == 0)")) (("g_error [(]\"GdmSession: no session desktop files installed, aborting\\.\\.\\.\"[)];")
(("g_error [(]\"GdmSession: no session desktop files installed, aborting\\.\\.\\.\"[)];") "{ self->fallback_session_name = g_strdup(\"fail\"); goto out; }"))))
"{ self->fallback_session_name = g_strdup(\"fail\"); goto out; }")))) (add-before 'install 'install-logo
(add-before 'install 'install-logo (lambda* (#:key inputs #:allow-other-keys)
(lambda* (#:key inputs outputs #:allow-other-keys) (let ((icon (search-input-file inputs "share/icons/hicolor/\
(let* ((out (assoc-ref outputs "out"))
(guix-icons (assoc-ref inputs "guix-icons"))
(icon
(string-append guix-icons "/share/icons/hicolor/\
scalable/apps/guix-white-icon.svg")) scalable/apps/guix-white-icon.svg"))
(schema (schema (string-append #$output "/share/glib-2.0/schemas/\
(string-append out "/share/glib-2.0/schemas/\
org.gnome.login-screen.gschema.override"))) org.gnome.login-screen.gschema.override")))
(mkdir-p (dirname schema)) (mkdir-p (dirname schema))
(with-output-to-file schema (with-output-to-file schema
(lambda () (lambda ()
(format #t "\ (format #t "\
[org.gnome.login-screen] [org.gnome.login-screen]
logo='~a'~%" icon)))))) logo='~a'~%" icon))))))
;; GDM requires that there be at least one desktop entry ;; GDM requires that there be at least one desktop entry
;; file. This phase installs a hidden one that simply ;; file. This phase installs a hidden one that simply
;; fails. This enables users to use GDM with a ;; fails. This enables users to use GDM with a
;; '~/.xsession' script with no other desktop entry files. ;; '~/.xsession' script with no other desktop entry files.
;; See <https://bugs.gnu.org/35068>. ;; See <https://bugs.gnu.org/35068>.
(add-after 'install 'install-placeholder-desktop-entry (add-after 'install 'install-placeholder-desktop-entry
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda _
(let* ((out (assoc-ref outputs "out")) (let* ((sessions (string-append #$output
(sessions (string-append out "/share/gdm/BuiltInSessions")) "/share/gdm/BuiltInSessions"))
(fail (string-append sessions "/fail.desktop"))) (fail (string-append sessions "/fail.desktop")))
(mkdir-p sessions) (mkdir-p sessions)
(with-output-to-file fail (with-output-to-file fail
(lambda () (lambda ()
(for-each (for-each
display display
'("[Desktop Entry]\n" '("[Desktop Entry]\n"
"Encoding=UTF-8\n" "Encoding=UTF-8\n"
"Type=Application\n" "Type=Application\n"
"Name=Fail\n" "Name=Fail\n"
"Comment=This session fails immediately.\n" "Comment=This session fails immediately.\n"
"NoDisplay=true\n" "NoDisplay=true\n"
"Exec=false\n"))))))) "Exec=false\n")))))))
;; GDM needs GNOME Session to run these applications. We link ;; GDM needs GNOME Session to run these applications. We link
;; their autostart files in `share/gdm/greeter/autostart' ;; their autostart files in `share/gdm/greeter/autostart'
;; because GDM explicitly tells GNOME Session to look there. ;; because GDM explicitly tells GNOME Session to look there.
;; ;;
;; XXX: GNOME Shell should be linked here too, but currently ;; XXX: GNOME Shell should be linked here too, but currently
;; GNOME Shell depends on GDM. ;; GNOME Shell depends on GDM.
(add-after 'install 'link-autostart-files (add-after 'install 'link-autostart-files
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((autostart (string-append #$output "/share/gdm/"
(autostart (string-append out "/share/gdm/"
"greeter/autostart")) "greeter/autostart"))
(settings (assoc-ref inputs "gnome-settings-daemon"))) (settings #$(this-package-input "gnome-settings-daemon")))
(mkdir-p autostart) (mkdir-p autostart)
(with-directory-excursion autostart (with-directory-excursion autostart
(for-each (lambda (desktop) (for-each (lambda (desktop)
(symlink desktop (basename desktop))) (symlink desktop (basename desktop)))
(find-files (find-files
(string-append settings "/etc/xdg")))))))))) (string-append settings "/etc/xdg"))))))))))
(native-inputs (native-inputs
`(("dconf" ,dconf) (list `(,glib "bin") ;for glib-compile-schemas, etc.
("glib:bin" ,glib "bin") ; for glib-compile-schemas, etc. dconf
("gobject-introspection" ,gobject-introspection) gobject-introspection
("guix-icons" ,guix-icons) guix-icons
("intltool" ,intltool) intltool
("itstool" ,itstool) itstool
("pkg-config" ,pkg-config) libxml2
("xmllint" ,libxml2))) pkg-config))
(inputs (inputs
(list accountsservice (list accountsservice
check ;for testing check ;for testing
elogind elogind
eudev eudev
gnome-session gnome-session