diff --git a/pkgs/desktops/gnome-3/core/gdm/default.nix b/pkgs/desktops/gnome-3/core/gdm/default.nix index 58c898a5f0d..f068ab531d9 100644 --- a/pkgs/desktops/gnome-3/core/gdm/default.nix +++ b/pkgs/desktops/gnome-3/core/gdm/default.nix @@ -1,7 +1,35 @@ -{ stdenv, fetchurl, substituteAll, pkgconfig, glib, itstool, libxml2, xorg -, accountsservice, libX11, gnome3, systemd, autoreconfHook, dconf -, gtk3, libcanberra-gtk3, pam, libtool, gobject-introspection, plymouth -, librsvg, coreutils, xwayland, nixos-icons, fetchpatch }: +{ stdenv +, fetchurl +, fetchpatch +, substituteAll +, meson +, ninja +, python3 +, rsync +, pkg-config +, glib +, itstool +, libxml2 +, xorg +, accountsservice +, libX11 +, gnome3 +, systemd +, dconf +, gtk3 +, libcanberra-gtk3 +, pam +, libselinux +, keyutils +, audit +, gobject-introspection +, plymouth +, librsvg +, coreutils +, xwayland +, dbus +, nixos-icons +}: let @@ -19,44 +47,64 @@ in stdenv.mkDerivation rec { pname = "gdm"; - version = "3.34.1"; + version = "3.38.0"; + + outputs = [ "out" "dev" ]; src = fetchurl { url = "mirror://gnome/sources/gdm/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; - sha256 = "1lyqvcwxhwxklbxn4xjswjzr6fhjix6h28mi9ypn34wdm9bzcpg8"; + sha256 = "1fimhklb204rflz8k345756jikgbw8113hms3zlcwk6975f43m26"; }; - # Only needed to make it build - preConfigure = '' - substituteInPlace ./configure --replace "/usr/bin/X" "${xorg.xorgserver.out}/bin/X" - ''; - - initialVT = "7"; - - configureFlags = [ + mesonFlags = [ + "-Dgdm-xsession=true" + # TODO: Setup a default-path? https://gitlab.gnome.org/GNOME/gdm/-/blob/6fc40ac6aa37c8ad87c32f0b1a5d813d34bf7770/meson_options.txt#L6 + "-Dinitial-vt=${passthru.initialVT}" + "-Dudev-dir=${placeholder "out"}/lib/udev/rules.d" + "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system" + "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user" "--sysconfdir=/etc" "--localstatedir=/var" - "--with-plymouth=yes" - "--enable-gdm-xsession" - "--with-initial-vt=${initialVT}" - "--with-systemdsystemunitdir=$(out)/etc/systemd/system" - "--with-udevdir=$(out)/lib/udev" ]; - nativeBuildInputs = [ pkgconfig libxml2 itstool autoreconfHook libtool dconf ]; + nativeBuildInputs = [ + dconf + glib # for glib-compile-schemas + itstool + meson + ninja + pkg-config + python3 + rsync + ]; + buildInputs = [ - glib accountsservice systemd - gobject-introspection libX11 gtk3 - libcanberra-gtk3 pam plymouth librsvg + accountsservice + audit + glib + gobject-introspection + gtk3 + keyutils + libX11 + libcanberra-gtk3 + libselinux + pam + plymouth + systemd + xorg.libXdmcp ]; - enableParallelBuilding = true; - patches = [ + # https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/112 + (fetchpatch { + url = "https://gitlab.gnome.org/GNOME/gdm/-/commit/1d28d4b3568381b8590d2235737b924aefd1746c.patch"; + sha256 = "ZUXKZS4T0o0hzrApxaqcR0txCRv5zBgqeQ9K9fLNX1o="; + }) + # Change hardcoded paths to nix store paths. (substituteAll { src = ./fix-paths.patch; - inherit coreutils plymouth xwayland; + inherit coreutils plymouth xwayland dbus; }) # The following patches implement certain environment variables in GDM which are set by @@ -74,23 +122,61 @@ stdenv.mkDerivation rec { # Set up the environment properly when launching sessions # https://github.com/NixOS/nixpkgs/issues/48255 ./reset-environment.patch + + # Fix runtime patch location. + # https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/114 + (fetchpatch { + url = "https://gitlab.gnome.org/GNOME/gdm/-/commit/9d841d681f3d1c58e3df51a98421257f774cd185.patch"; + sha256 = "0lf5kpz9ghylqlbybc0mpfsvr4i29z1ag8wf6j1918hjrfcipnxj"; + }) ]; - installFlags = [ - "sysconfdir=$(out)/etc" - "dbusconfdir=$(out)/etc/dbus-1/system.d" - ]; + postPatch = '' + patchShebangs build-aux/meson_post_install.py + + # Upstream checks some common paths to find an `X` binary. We already know it. + echo #!/bin/sh > build-aux/find-x-server.sh + echo "echo ${stdenv.lib.getBin xorg.xorgserver}/bin/X" >> build-aux/find-x-server.sh + patchShebangs build-aux/find-x-server.sh + ''; preInstall = '' - schema_dir=${glib.makeSchemaPath "$out" "${pname}-${version}"} - install -D ${override} $schema_dir/org.gnome.login-screen.gschema.override + install -D ${override} ${DESTDIR}/$out/share/glib-2.0/schemas/org.gnome.login-screen.gschema.override ''; + postInstall = '' + # Move stuff from DESTDIR to proper location. + # We use rsync to merge the directories. + rsync --archive "${DESTDIR}/etc" "$out" + rm --recursive "${DESTDIR}/etc" + for o in $outputs; do + rsync --archive "${DESTDIR}/''${!o}" "$(dirname "''${!o}")" + rm --recursive "${DESTDIR}/''${!o}" + done + # Ensure the DESTDIR is removed. + rmdir "${DESTDIR}/nix/store" "${DESTDIR}/nix" "${DESTDIR}" + + # We are setting DESTDIR so the post-install script does not compile the schemas. + glib-compile-schemas "$out/share/glib-2.0/schemas" + ''; + + # HACK: We want to install configuration files to $out/etc + # but GDM should read them from /etc on a NixOS system. + # With autotools, it was possible to override Make variables + # at install time but Meson does not support this + # so we need to convince it to install all files to a temporary + # location using DESTDIR and then move it to proper one in postInstall. + DESTDIR = "${placeholder "out"}/dest"; + passthru = { updateScript = gnome3.updateScript { packageName = "gdm"; attrPath = "gnome3.gdm"; }; + + # Used in GDM NixOS module + # Don't remove. + initialVT = "7"; }; meta = with stdenv.lib; { diff --git a/pkgs/desktops/gnome-3/core/gdm/fix-paths.patch b/pkgs/desktops/gnome-3/core/gdm/fix-paths.patch index 6b5bd6152bd..d649556fe9e 100644 --- a/pkgs/desktops/gnome-3/core/gdm/fix-paths.patch +++ b/pkgs/desktops/gnome-3/core/gdm/fix-paths.patch @@ -13,48 +13,70 @@ +++ b/daemon/gdm-manager.c @@ -145,7 +145,7 @@ GError *error; - + error = NULL; -- res = g_spawn_command_line_sync ("/bin/plymouth --ping", +- res = g_spawn_command_line_sync ("plymouth --ping", + res = g_spawn_command_line_sync ("@plymouth@/bin/plymouth --ping", NULL, NULL, &status, &error); if (! res) { g_debug ("Could not ping plymouth: %s", error->message); @@ -163,7 +163,7 @@ GError *error; - + error = NULL; -- res = g_spawn_command_line_sync ("/bin/plymouth deactivate", +- res = g_spawn_command_line_sync ("plymouth deactivate", + res = g_spawn_command_line_sync ("@plymouth@/bin/plymouth deactivate", NULL, NULL, NULL, &error); if (! res) { g_warning ("Could not deactivate plymouth: %s", error->message); @@ -178,7 +178,7 @@ GError *error; - + error = NULL; -- res = g_spawn_command_line_async ("/bin/plymouth quit --retain-splash", &error); +- res = g_spawn_command_line_async ("plymouth quit --retain-splash", &error); + res = g_spawn_command_line_async ("@plymouth@/bin/plymouth quit --retain-splash", &error); if (! res) { g_warning ("Could not quit plymouth: %s", error->message); g_error_free (error); @@ -194,7 +194,7 @@ GError *error; - + error = NULL; -- res = g_spawn_command_line_async ("/bin/plymouth quit", &error); +- res = g_spawn_command_line_async ("plymouth quit", &error); + res = g_spawn_command_line_async ("@plymouth@/bin/plymouth quit", &error); if (! res) { g_warning ("Could not quit plymouth: %s", error->message); g_error_free (error); --- a/data/gdm.service.in +++ b/data/gdm.service.in -@@ -28,7 +28,7 @@ BusName=org.gnome.DisplayManager - StandardOutput=syslog - StandardError=inherit - EnvironmentFile=-@LANG_CONFIG_FILE@ +@@ -26,7 +26,7 @@ Restart=always + IgnoreSIGPIPE=no + BusName=org.gnome.DisplayManager + EnvironmentFile=-${LANG_CONFIG_FILE} -ExecReload=/bin/kill -SIGHUP $MAINPID +ExecReload=@coreutils@/bin/kill -SIGHUP $MAINPID KeyringMode=shared - + [Install] +--- a/daemon/gdm-session.c ++++ b/daemon/gdm-session.c +@@ -2916,16 +2916,16 @@ gdm_session_start_session (GdmSession *self, + */ + if (run_launcher) { + if (is_x11) { +- program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s\"dbus-run-session -- %s\"", ++ program = g_strdup_printf (LIBEXECDIR "/gdm-x-session %s\"@dbus@/bin/dbus-run-session --dbus-daemon=@dbus@/bin/dbus-daemon -- %s\"", + register_session ? "--register-session " : "", + self->selected_program); + } else { +- program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"dbus-run-session -- %s\"", ++ program = g_strdup_printf (LIBEXECDIR "/gdm-wayland-session %s\"@dbus@/bin/dbus-run-session --dbus-daemon=@dbus@/bin/dbus-daemon -- %s\"", + register_session ? "--register-session " : "", + self->selected_program); + } + } else { +- program = g_strdup_printf ("dbus-run-session -- %s", ++ program = g_strdup_printf ("@dbus@/bin/dbus-run-session --dbus-daemon=@dbus@/bin/dbus-daemon -- %s", + self->selected_program); + } + }