Merge pull request #242009 from K900/sddm-wayland

nixos/sddm: enable Wayland support
This commit is contained in:
K900 2023-10-03 16:19:13 +03:00 committed by GitHub
commit 08751dfd40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 1 deletions

View file

@ -33,6 +33,8 @@ let
# Implementation is done via pkgs/applications/display-managers/sddm/sddm-default-session.patch # Implementation is done via pkgs/applications/display-managers/sddm/sddm-default-session.patch
DefaultSession = optionalString (dmcfg.defaultSession != null) "${dmcfg.defaultSession}.desktop"; DefaultSession = optionalString (dmcfg.defaultSession != null) "${dmcfg.defaultSession}.desktop";
DisplayServer = if cfg.wayland.enable then "wayland" else "x11";
}; };
Theme = { Theme = {
@ -62,6 +64,7 @@ let
Wayland = { Wayland = {
EnableHiDPI = cfg.enableHidpi; EnableHiDPI = cfg.enableHidpi;
SessionDir = "${dmcfg.sessionData.desktops}/share/wayland-sessions"; SessionDir = "${dmcfg.sessionData.desktops}/share/wayland-sessions";
CompositorCommand = lib.optionalString cfg.wayland.enable cfg.wayland.compositorCommand;
}; };
} // lib.optionalAttrs dmcfg.autoLogin.enable { } // lib.optionalAttrs dmcfg.autoLogin.enable {
Autologin = { Autologin = {
@ -184,6 +187,32 @@ in
''; '';
}; };
}; };
# Experimental Wayland support
wayland = {
enable = mkEnableOption "experimental Wayland support";
compositorCommand = mkOption {
type = types.str;
internal = true;
# This is basically the upstream default, but with Weston referenced by full path
# and the configuration generated from NixOS options.
default = let westonIni = (pkgs.formats.ini {}).generate "weston.ini" {
libinput = {
enable-tap = xcfg.libinput.mouse.tapping;
left-handed = xcfg.libinput.mouse.leftHanded;
};
keyboard = {
keymap_model = xcfg.xkbModel;
keymap_layout = xcfg.layout;
keymap_variant = xcfg.xkbVariant;
keymap_options = xcfg.xkbOptions;
};
}; in "${pkgs.weston}/bin/weston --shell=fullscreen-shell.so -c ${westonIni}";
description = lib.mdDoc "Command used to start the selected compositor";
};
};
}; };
}; };

View file

@ -1,4 +1,4 @@
{ mkDerivation, lib, fetchFromGitHub { mkDerivation, lib, fetchFromGitHub, fetchpatch
, cmake, extra-cmake-modules, pkg-config, qttools , cmake, extra-cmake-modules, pkg-config, qttools
, libxcb, libXau, pam, qtbase, qtdeclarative, qtquickcontrols2, systemd, xkeyboardconfig , libxcb, libXau, pam, qtbase, qtdeclarative, qtquickcontrols2, systemd, xkeyboardconfig
}: }:
@ -16,6 +16,25 @@ mkDerivation rec {
patches = [ patches = [
./sddm-ignore-config-mtime.patch ./sddm-ignore-config-mtime.patch
./sddm-default-session.patch ./sddm-default-session.patch
# FIXME: all of the following are Wayland related backports, drop in next release
# Don't use Qt virtual keyboard on Wayland
(fetchpatch {
url = "https://github.com/sddm/sddm/commit/07631f2ef00a52d883d0fd47ff7d1e1a6bc6358f.patch";
hash = "sha256-HTSw3YeT4z9ldr4sLmsnrPQ+LA8/a6XxrF+KUFqXUlM=";
})
# Fix running sddm-greeter manually in Wayland sessions
(fetchpatch {
url = "https://github.com/sddm/sddm/commit/e27b70957505dc7b986ab2fa68219af546c63344.patch";
hash = "sha256-6hzrFeS2epL9vzLOA29ZA/dD3Jd4rPMBHhNp+FBq1bA=";
})
# Prefer GreeterEnvironment over PAM environment
(fetchpatch {
url = "https://github.com/sddm/sddm/commit/9e7791d5fb375933d20f590daba9947195515b26.patch";
hash = "sha256-JNsVTJNZV6T+SPqPkaFf3wg8NDqXGx8NZ4qQfZWOli4=";
})
]; ];
postPatch = '' postPatch = ''