From c0132f22e935dbce8476fff255b3daf9f6e24ec3 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 23 Jun 2023 17:41:57 +0300 Subject: [PATCH] sddm: 0.19.0 -> 0.20.0 --- .../services/x11/display-managers/sddm.nix | 11 ++++ nixos/tests/sddm.nix | 14 ++--- .../display-managers/sddm/default.nix | 59 ++++++++----------- .../sddm/sddm-default-session.patch | 38 ++++++------ 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix index 0ddeac0f1098..c04edd0d4b7a 100644 --- a/nixos/modules/services/x11/display-managers/sddm.nix +++ b/nixos/modules/services/x11/display-managers/sddm.nix @@ -268,6 +268,17 @@ in environment.systemPackages = [ sddm ]; services.dbus.packages = [ sddm ]; + # We're not using the upstream unit, so copy these: https://github.com/sddm/sddm/blob/develop/services/sddm.service.in + systemd.services.display-manager.after = [ + "systemd-user-sessions.service" + "getty@tty7.service" + "plymouth-quit.service" + "systemd-logind.service" + ]; + systemd.services.display-manager.conflicts = [ + "getty@tty7.service" + ]; + # To enable user switching, allow sddm to allocate TTYs/displays dynamically. services.xserver.tty = null; services.xserver.display = null; diff --git a/nixos/tests/sddm.nix b/nixos/tests/sddm.nix index c76a9683e66d..b6c05deac05e 100644 --- a/nixos/tests/sddm.nix +++ b/nixos/tests/sddm.nix @@ -23,14 +23,14 @@ let enableOCR = true; testScript = { nodes, ... }: let - user = nodes.machine.config.users.users.alice; + user = nodes.machine.users.users.alice; in '' start_all() machine.wait_for_text("(?i)select your user") machine.screenshot("sddm") machine.send_chars("${user.password}\n") - machine.wait_for_file("${user.home}/.Xauthority") - machine.succeed("xauth merge ${user.home}/.Xauthority") + machine.wait_for_file("/tmp/xauth_*") + machine.succeed("xauth merge /tmp/xauth_*") machine.wait_for_window("^IceWM ") ''; }; @@ -55,12 +55,10 @@ let services.xserver.windowManager.icewm.enable = true; }; - testScript = { nodes, ... }: let - user = nodes.machine.config.users.users.alice; - in '' + testScript = { nodes, ... }: '' start_all() - machine.wait_for_file("${user.home}/.Xauthority") - machine.succeed("xauth merge ${user.home}/.Xauthority") + machine.wait_for_file("/tmp/xauth_*") + machine.succeed("xauth merge /tmp/xauth_*") machine.wait_for_window("^IceWM ") ''; }; diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix index 7a8f16ef1b14..04826274bb69 100644 --- a/pkgs/applications/display-managers/sddm/default.nix +++ b/pkgs/applications/display-managers/sddm/default.nix @@ -1,59 +1,44 @@ -{ mkDerivation, lib, fetchFromGitHub, fetchpatch -, cmake, extra-cmake-modules, pkg-config, libxcb, libpthreadstubs -, libXdmcp, libXau, qtbase, qtdeclarative, qtquickcontrols2, qttools, pam, systemd +{ mkDerivation, lib, fetchFromGitHub +, cmake, extra-cmake-modules, pkg-config, qttools +, libxcb, libXau, pam, qtbase, qtdeclarative, qtquickcontrols2, systemd, xkeyboardconfig }: - -let - version = "0.19.0"; - -in mkDerivation { +mkDerivation rec { pname = "sddm"; - inherit version; + version = "0.20.0"; src = fetchFromGitHub { owner = "sddm"; repo = "sddm"; rev = "v${version}"; - sha256 = "1s6icb5r1n6grfs137gdzfrcvwsb3hvlhib2zh6931x8pkl1qvxa"; + hash = "sha256-ctZln1yQov+p/outkQhcWZp46IKITC04e22RfePwEM4="; }; patches = [ ./sddm-ignore-config-mtime.patch ./sddm-default-session.patch - # Load `/etc/profile` for `environment.variables` with zsh default shell. - # See: https://github.com/sddm/sddm/pull/1382 - (fetchpatch { - url = "https://github.com/sddm/sddm/commit/e1dedeeab6de565e043f26ac16033e613c222ef9.patch"; - sha256 = "sha256-OPyrUI3bbH+PGDBfoL4Ohb4wIvmy9TeYZhE0JxR/D58="; - }) - # Fix build with Qt 5.15.3 - # See: https://github.com/sddm/sddm/pull/1325 - (fetchpatch { - url = "https://github.com/sddm/sddm/commit/e93bf95c54ad8c2a1604f8d7be05339164b19308.patch"; - sha256 = "sha256:1rh6sdvzivjcl5b05fczarvxhgpjhi7019hvf2gadnwgwdg104r4"; - }) - # Fix fails to start while starting X server - # See: https://github.com/sddm/sddm/pull/1324 - (fetchpatch { - url = "https://github.com/sddm/sddm/commit/adfaa222fdfa6115ea2b320b0bbc2126db9270a5.patch"; - sha256 = "sha256-q/YLlAjxluzHMKUUQglLo3RyyhERQGPHXGr56+4R9VU="; - }) ]; - postPatch = - # Fix missing include for gettimeofday() - '' - sed -e '1i#include ' -i src/helper/HelperApp.cpp - ''; + postPatch = '' + substituteInPlace src/greeter/waylandkeyboardbackend.cpp \ + --replace "/usr/share/X11/xkb/rules/evdev.xml" "${xkeyboardconfig}/share/X11/xkb/rules/evdev.xml" + ''; nativeBuildInputs = [ cmake extra-cmake-modules pkg-config qttools ]; buildInputs = [ - libxcb libpthreadstubs libXdmcp libXau pam qtbase qtdeclarative qtquickcontrols2 systemd + libxcb + libXau + pam + qtbase + qtdeclarative + qtquickcontrols2 + systemd ]; cmakeFlags = [ "-DCONFIG_FILE=/etc/sddm.conf" + "-DCONFIG_DIR=/etc/sddm.conf.d" + # Set UID_MIN and UID_MAX so that the build script won't try # to read them from /etc/login.defs (fails in chroot). # The values come from NixOS; they may not be appropriate @@ -62,9 +47,15 @@ in mkDerivation { "-DUID_MIN=1000" "-DUID_MAX=29999" + # we still want to run the DM on VT 7 for the time being, as 1-6 are + # occupied by getties by default + "-DSDDM_INITIAL_VT=7" + "-DQT_IMPORTS_DIR=${placeholder "out"}/${qtbase.qtQmlPrefix}" "-DCMAKE_INSTALL_SYSCONFDIR=${placeholder "out"}/etc" "-DSYSTEMD_SYSTEM_UNIT_DIR=${placeholder "out"}/lib/systemd/system" + "-DSYSTEMD_SYSUSERS_DIR=${placeholder "out"}/lib/sysusers.d" + "-DSYSTEMD_TMPFILES_DIR=${placeholder "out"}/lib/tmpfiles.d" "-DDBUS_CONFIG_DIR=${placeholder "out"}/share/dbus-1/system.d" ]; diff --git a/pkgs/applications/display-managers/sddm/sddm-default-session.patch b/pkgs/applications/display-managers/sddm/sddm-default-session.patch index 455ebbd41577..0227b35c98d7 100644 --- a/pkgs/applications/display-managers/sddm/sddm-default-session.patch +++ b/pkgs/applications/display-managers/sddm/sddm-default-session.patch @@ -1,38 +1,39 @@ diff --git a/src/common/Configuration.h b/src/common/Configuration.h -index cf44a62..7bb9c03 100644 +index 54bcace..49cf5cb 100644 --- a/src/common/Configuration.h +++ b/src/common/Configuration.h -@@ -44,6 +44,7 @@ namespace SDDM { - "NOTE: Currently ignored if autologin is enabled.")); +@@ -48,6 +48,8 @@ namespace SDDM { Entry(InputMethod, QString, QStringLiteral("qtvirtualkeyboard"), _S("Input method module")); Entry(Namespaces, QStringList, QStringList(), _S("Comma-separated list of Linux namespaces for user session to enter")); + Entry(GreeterEnvironment, QStringList, QStringList(), _S("Comma-separated list of environment variables to be set")); + Entry(DefaultSession, QString, QString(), _S("System-wide default session")); ++ // Name Entries (but it's a regular class again) Section(Theme, Entry(ThemeDir, QString, _S(DATA_INSTALL_DIR "/themes"), _S("Theme directory path")); diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp -index 1953c76..54fe2f2 100644 +index d8698b7..df3e3c4 100644 --- a/src/greeter/SessionModel.cpp +++ b/src/greeter/SessionModel.cpp -@@ -43,6 +43,7 @@ namespace SDDM { - beginResetModel(); - populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); +@@ -49,6 +49,7 @@ namespace SDDM { + if (dri_active) + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + selectDefaultSession(); endResetModel(); - + // refresh everytime a file is changed, added or removed -@@ -52,6 +53,7 @@ namespace SDDM { - d->sessions.clear(); - populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); +@@ -62,6 +63,7 @@ namespace SDDM { + if (dri_active) + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); populate(Session::X11Session, mainConfig.X11.SessionDir.get()); + selectDefaultSession(); endResetModel(); }); - watcher->addPath(mainConfig.Wayland.SessionDir.get()); -@@ -149,11 +151,25 @@ namespace SDDM { - else + watcher->addPaths(mainConfig.Wayland.SessionDir.get()); +@@ -164,11 +166,25 @@ namespace SDDM { delete si; + } } + } + @@ -58,14 +59,13 @@ index 1953c76..54fe2f2 100644 } } diff --git a/src/greeter/SessionModel.h b/src/greeter/SessionModel.h -index 2e2efa9..a93315c 100644 +index 8f4d539..02f77ce 100644 --- a/src/greeter/SessionModel.h +++ b/src/greeter/SessionModel.h -@@ -58,6 +58,7 @@ namespace SDDM { +@@ -59,6 +59,7 @@ namespace SDDM { SessionModelPrivate *d { nullptr }; - - void populate(Session::Type type, const QString &path); + + void populate(Session::Type type, const QStringList &dirPaths); + void selectDefaultSession(); }; } -