Merge pull request #6677 from abbradar/sddm

Add SDDM display manager
This commit is contained in:
Nikolay Amiantov 2015-03-05 21:03:43 +03:00
commit 4fde098eec
6 changed files with 217 additions and 1 deletions

View File

@ -180,6 +180,7 @@
panamax = 170;
marathon = 171;
exim = 172;
sddm = 175;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@ -322,6 +323,7 @@
exim = 172;
fleet = 173;
input = 174;
sddm = 175;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

View File

@ -359,6 +359,7 @@
./services/x11/display-managers/gdm.nix
./services/x11/display-managers/kdm.nix
./services/x11/display-managers/lightdm.nix
./services/x11/display-managers/sddm.nix
./services/x11/display-managers/slim.nix
./services/x11/hardware/multitouch.nix
./services/x11/hardware/synaptics.nix

View File

@ -0,0 +1,108 @@
{ config, lib, pkgs, ... }:
with lib;
let
xcfg = config.services.xserver;
dmcfg = xcfg.displayManager;
cfg = dmcfg.sddm;
xEnv = config.systemd.services."display-manager".environment;
xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
#!/bin/sh
${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)}
exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
'';
cfgFile = pkgs.writeText "sddm.conf" ''
[General]
HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
RebootCommand=${pkgs.systemd}/bin/systemctl reboot
[Theme]
Current=${cfg.theme}
[Users]
MaximumUid=${toString config.ids.uids.nixbld}
[XDisplay]
MinimumVT=${toString xcfg.tty}
ServerPath=${xserverWrapper}
XephyrPath=${pkgs.xorg.xorgserver}/bin/Xephyr
SessionCommand=${dmcfg.session.script}
SessionDir=${dmcfg.session.desktops}
XauthPath=${pkgs.xorg.xauth}/bin/xauth
'';
in
{
options = {
services.xserver.displayManager.sddm = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable sddm as the display manager.
'';
};
theme = mkOption {
type = types.str;
default = "maui";
description = ''
Greeter theme to use.
'';
};
};
};
config = mkIf cfg.enable {
services.xserver.displayManager.slim.enable = false;
services.xserver.displayManager.job = {
logsXsession = true;
#execCmd = "${pkgs.sddm}/bin/sddm";
execCmd = "exec ${pkgs.sddm}/bin/sddm";
};
security.pam.services = {
sddm = {
allowNullPassword = true;
startSession = true;
};
sddm-greeter.text = ''
auth required pam_succeed_if.so audit quiet_success user = sddm
auth optional pam_permit.so
account required pam_succeed_if.so audit quiet_success user = sddm
account sufficient pam_unix.so
password required pam_deny.so
session required pam_succeed_if.so audit quiet_success user = sddm
session required pam_env.so envfile=${config.system.build.pamEnvironment}
session optional ${pkgs.systemd}/lib/security/pam_systemd.so
session optional pam_keyinit.so force revoke
session optional pam_permit.so
'';
};
users.extraUsers.sddm = {
createHome = true;
home = "/var/lib/sddm";
group = "sddm";
uid = config.ids.uids.sddm;
};
environment.etc."sddm.conf".source = cfgFile;
users.extraGroups.sddm.gid = config.ids.gids.sddm;
};
}

View File

@ -0,0 +1,55 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d6e0a9..df4ad28 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,7 +77,9 @@ find_package(Qt5LinguistTools REQUIRED)
# find qt5 imports dir
get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
-exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" RETURN_VALUE return_code OUTPUT_VARIABLE QT_IMPORTS_DIR)
+if(NOT QT_IMPORTS_DIR)
+ exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" RETURN_VALUE return_code OUTPUT_VARIABLE QT_IMPORTS_DIR)
+endif()
# Set components version
set(COMPONENTS_VERSION 2.0)
diff --git a/data/man/sddm.conf.rst.in b/data/man/sddm.conf.rst.in
index 6a28224..798bc5c 100644
--- a/data/man/sddm.conf.rst.in
+++ b/data/man/sddm.conf.rst.in
@@ -65,6 +65,10 @@ OPTIONS
Path of the X server.
Default value is "/usr/bin/X".
+`XephyrPath=`
+ Path of the Xephyr.
+ Default value is "/usr/bin/Xephyr".
+
`XauthPath=`
Path of the Xauth.
Default value is "/usr/bin/xauth".
diff --git a/src/common/Configuration.h b/src/common/Configuration.h
index 72aa6f4..854cc22 100644
--- a/src/common/Configuration.h
+++ b/src/common/Configuration.h
@@ -54,6 +54,7 @@ namespace SDDM {
// TODO: Not absolutely sure if everything belongs here. Xsessions, VT and probably some more seem universal
Section(XDisplay,
Entry(ServerPath, QString, _S("/usr/bin/X"), _S("X server path"));
+ Entry(XephyrPath, QString, _S("/usr/bin/Xephyr"), _S("Xephyr path"));
Entry(XauthPath, QString, _S("/usr/bin/xauth"), _S("Xauth path"));
Entry(SessionDir, QString, _S("/usr/share/xsessions"), _S("Session description directory"));
Entry(SessionCommand, QString, _S(SESSION_COMMAND), _S("Xsession script path\n"
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
index f10ad82..cb9de3f 100644
--- a/src/daemon/XorgDisplayServer.cpp
+++ b/src/daemon/XorgDisplayServer.cpp
@@ -136,7 +136,7 @@ namespace SDDM {
if (daemonApp->testing()) {
QStringList args;
args << m_display << "-ac" << "-br" << "-noreset" << "-screen" << "800x600";
- process->start("/usr/bin/Xephyr", args);
+ process->start(mainConfig.XDisplay.XephyrPath.get(), args);
} else {
// set process environment
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

View File

@ -0,0 +1,47 @@
{ stdenv, fetchpatch, makeWrapper, fetchFromGitHub, cmake, pkgconfig, libxcb, libpthreadstubs
, libXdmcp, libXau, qt5, pam, systemd }:
let
version = "0.11.0";
in
stdenv.mkDerivation rec {
name = "sddm-${version}";
src = fetchFromGitHub {
owner = "sddm";
repo = "sddm";
rev = "v${version}";
sha256 = "1s1gm0xvgwzrpxgni3ngdj8phzg21gkk1jyiv2l2i5ayl0jdm7ig";
};
nativeBuildInputs = [ cmake pkgconfig qt5.tools makeWrapper ];
buildInputs = [ libxcb libpthreadstubs libXdmcp libXau qt5.base pam systemd ];
patches = [ (fetchpatch {
url = "https://github.com/sddm/sddm/commit/9bc21ee7da5de6b2531d47d1af4d7b0a169990b9.patch";
sha256 = "1pda0wf4xljdadja7iyh5c48h0347imadg9ya1dw5slgb7w1d94l";
})
./cmake_paths.patch
];
cmakeFlags = [ "-DCONFIG_FILE=/etc/sddm.conf" ];
preConfigure = ''
export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
'';
postInstall = ''
wrapProgram $out/bin/sddm-greeter \
--set QML2_IMPORT_PATH "${qt5.declarative}/lib/qt5/qml/"
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "QML based X11 display manager";
homepage = http://launchpad.net/lightdm;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}

View File

@ -11449,11 +11449,14 @@ let
printrun = callPackage ../applications/misc/printrun { };
sddm = callPackage ../applications/display-managers/sddm {
qt5 = qt54;
};
slim = callPackage ../applications/display-managers/slim {
libpng = libpng12;
};
smartgithg = callPackage ../applications/version-management/smartgithg { };
slimThemes = recurseIntoAttrs (import ../applications/display-managers/slim/themes.nix {