git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #6677 from abbradar/sddm

Add SDDM display manager

commit4fde098eecfb1d358fbd88d2f63d9da2bfe881f0 authorNikolay Amiantov <ab@fmap.me> dateThu 5 Mar 2015, 21:03 (12 years ago) parentac700c6db5b08c
6 files changed+217−1
nixos/modules/misc/ids.nix+2 nixos/modules/module-list.nix+1 nixos/modules/services/x11/display-managers/sddm.nix+108 pkgs/applications/display-managers/sddm/cmake_paths.patch+55 pkgs/applications/display-managers/sddm/default.nix+47 pkgs/top-level/all-packages.nix+4−1
nixos/modules/misc/ids.nix+2
@@ -180,6 +180,7 @@
180180 panamax = 170;
181181 marathon = 171;
182182 exim = 172;
183+ sddm = 175;
183184
184185 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
185186
@@ -322,6 +323,7 @@
322323 exim = 172;
323324 fleet = 173;
324325 input = 174;
326+ sddm = 175;
325327
326328 # When adding a gid, make sure it doesn't match an existing
327329 # uid. Users and groups with the same name should have equal
nixos/modules/module-list.nix+1
@@ -359,6 +359,7 @@
359359 ./services/x11/display-managers/gdm.nix
360360 ./services/x11/display-managers/kdm.nix
361361 ./services/x11/display-managers/lightdm.nix
362+ ./services/x11/display-managers/sddm.nix
362363 ./services/x11/display-managers/slim.nix
363364 ./services/x11/hardware/multitouch.nix
364365 ./services/x11/hardware/synaptics.nix
nixos/modules/services/x11/display-managers/sddm.nixnew file+108
@@ -0,0 +1,108 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+
7+ xcfg = config.services.xserver;
8+ dmcfg = xcfg.displayManager;
9+ cfg = dmcfg.sddm;
10+ xEnv = config.systemd.services."display-manager".environment;
11+
12+ xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
13+ #!/bin/sh
14+ ${concatMapStrings (n: "export ${n}=\"${getAttr n xEnv}\"\n") (attrNames xEnv)}
15+ exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs} "$@"
16+ '';
17+
18+ cfgFile = pkgs.writeText "sddm.conf" ''
19+ [General]
20+ HaltCommand=${pkgs.systemd}/bin/systemctl poweroff
21+ RebootCommand=${pkgs.systemd}/bin/systemctl reboot
22+
23+ [Theme]
24+ Current=${cfg.theme}
25+
26+ [Users]
27+ MaximumUid=${toString config.ids.uids.nixbld}
28+
29+ [XDisplay]
30+ MinimumVT=${toString xcfg.tty}
31+ ServerPath=${xserverWrapper}
32+ XephyrPath=${pkgs.xorg.xorgserver}/bin/Xephyr
33+ SessionCommand=${dmcfg.session.script}
34+ SessionDir=${dmcfg.session.desktops}
35+ XauthPath=${pkgs.xorg.xauth}/bin/xauth
36+ '';
37+
38+in
39+{
40+ options = {
41+
42+ services.xserver.displayManager.sddm = {
43+ enable = mkOption {
44+ type = types.bool;
45+ default = false;
46+ description = ''
47+ Whether to enable sddm as the display manager.
48+ '';
49+ };
50+
51+ theme = mkOption {
52+ type = types.str;
53+ default = "maui";
54+ description = ''
55+ Greeter theme to use.
56+ '';
57+ };
58+ };
59+
60+ };
61+
62+ config = mkIf cfg.enable {
63+
64+ services.xserver.displayManager.slim.enable = false;
65+
66+ services.xserver.displayManager.job = {
67+ logsXsession = true;
68+
69+ #execCmd = "${pkgs.sddm}/bin/sddm";
70+ execCmd = "exec ${pkgs.sddm}/bin/sddm";
71+ };
72+
73+ security.pam.services = {
74+ sddm = {
75+ allowNullPassword = true;
76+ startSession = true;
77+ };
78+
79+ sddm-greeter.text = ''
80+ auth required pam_succeed_if.so audit quiet_success user = sddm
81+ auth optional pam_permit.so
82+
83+ account required pam_succeed_if.so audit quiet_success user = sddm
84+ account sufficient pam_unix.so
85+
86+ password required pam_deny.so
87+
88+ session required pam_succeed_if.so audit quiet_success user = sddm
89+ session required pam_env.so envfile=${config.system.build.pamEnvironment}
90+ session optional ${pkgs.systemd}/lib/security/pam_systemd.so
91+ session optional pam_keyinit.so force revoke
92+ session optional pam_permit.so
93+ '';
94+ };
95+
96+ users.extraUsers.sddm = {
97+ createHome = true;
98+ home = "/var/lib/sddm";
99+ group = "sddm";
100+ uid = config.ids.uids.sddm;
101+ };
102+
103+ environment.etc."sddm.conf".source = cfgFile;
104+
105+ users.extraGroups.sddm.gid = config.ids.gids.sddm;
106+
107+ };
108+}
pkgs/applications/display-managers/sddm/cmake_paths.patchnew file+55
@@ -0,0 +1,55 @@
1+diff --git a/CMakeLists.txt b/CMakeLists.txt
2+index 4d6e0a9..df4ad28 100644
3+--- a/CMakeLists.txt
4++++ b/CMakeLists.txt
5+@@ -77,7 +77,9 @@ find_package(Qt5LinguistTools REQUIRED)
6+
7+ # find qt5 imports dir
8+ get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
9+-exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" RETURN_VALUE return_code OUTPUT_VARIABLE QT_IMPORTS_DIR)
10++if(NOT QT_IMPORTS_DIR)
11++ exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_QML" RETURN_VALUE return_code OUTPUT_VARIABLE QT_IMPORTS_DIR)
12++endif()
13+
14+ # Set components version
15+ set(COMPONENTS_VERSION 2.0)
16+diff --git a/data/man/sddm.conf.rst.in b/data/man/sddm.conf.rst.in
17+index 6a28224..798bc5c 100644
18+--- a/data/man/sddm.conf.rst.in
19++++ b/data/man/sddm.conf.rst.in
20+@@ -65,6 +65,10 @@ OPTIONS
21+ Path of the X server.
22+ Default value is "/usr/bin/X".
23+
24++`XephyrPath=`
25++ Path of the Xephyr.
26++ Default value is "/usr/bin/Xephyr".
27++
28+ `XauthPath=`
29+ Path of the Xauth.
30+ Default value is "/usr/bin/xauth".
31+diff --git a/src/common/Configuration.h b/src/common/Configuration.h
32+index 72aa6f4..854cc22 100644
33+--- a/src/common/Configuration.h
34++++ b/src/common/Configuration.h
35+@@ -54,6 +54,7 @@ namespace SDDM {
36+ // TODO: Not absolutely sure if everything belongs here. Xsessions, VT and probably some more seem universal
37+ Section(XDisplay,
38+ Entry(ServerPath, QString, _S("/usr/bin/X"), _S("X server path"));
39++ Entry(XephyrPath, QString, _S("/usr/bin/Xephyr"), _S("Xephyr path"));
40+ Entry(XauthPath, QString, _S("/usr/bin/xauth"), _S("Xauth path"));
41+ Entry(SessionDir, QString, _S("/usr/share/xsessions"), _S("Session description directory"));
42+ Entry(SessionCommand, QString, _S(SESSION_COMMAND), _S("Xsession script path\n"
43+diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
44+index f10ad82..cb9de3f 100644
45+--- a/src/daemon/XorgDisplayServer.cpp
46++++ b/src/daemon/XorgDisplayServer.cpp
47+@@ -136,7 +136,7 @@ namespace SDDM {
48+ if (daemonApp->testing()) {
49+ QStringList args;
50+ args << m_display << "-ac" << "-br" << "-noreset" << "-screen" << "800x600";
51+- process->start("/usr/bin/Xephyr", args);
52++ process->start(mainConfig.XDisplay.XephyrPath.get(), args);
53+ } else {
54+ // set process environment
55+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
pkgs/applications/display-managers/sddm/default.nixnew file+47
@@ -0,0 +1,47 @@
1+{ stdenv, fetchpatch, makeWrapper, fetchFromGitHub, cmake, pkgconfig, libxcb, libpthreadstubs
2+, libXdmcp, libXau, qt5, pam, systemd }:
3+
4+let
5+ version = "0.11.0";
6+in
7+stdenv.mkDerivation rec {
8+ name = "sddm-${version}";
9+
10+ src = fetchFromGitHub {
11+ owner = "sddm";
12+ repo = "sddm";
13+ rev = "v${version}";
14+ sha256 = "1s1gm0xvgwzrpxgni3ngdj8phzg21gkk1jyiv2l2i5ayl0jdm7ig";
15+ };
16+
17+ nativeBuildInputs = [ cmake pkgconfig qt5.tools makeWrapper ];
18+
19+ buildInputs = [ libxcb libpthreadstubs libXdmcp libXau qt5.base pam systemd ];
20+
21+ patches = [ (fetchpatch {
22+ url = "https://github.com/sddm/sddm/commit/9bc21ee7da5de6b2531d47d1af4d7b0a169990b9.patch";
23+ sha256 = "1pda0wf4xljdadja7iyh5c48h0347imadg9ya1dw5slgb7w1d94l";
24+ })
25+ ./cmake_paths.patch
26+ ];
27+
28+ cmakeFlags = [ "-DCONFIG_FILE=/etc/sddm.conf" ];
29+
30+ preConfigure = ''
31+ export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
32+ '';
33+
34+ postInstall = ''
35+ wrapProgram $out/bin/sddm-greeter \
36+ --set QML2_IMPORT_PATH "${qt5.declarative}/lib/qt5/qml/"
37+ '';
38+
39+ enableParallelBuilding = true;
40+
41+ meta = with stdenv.lib; {
42+ description = "QML based X11 display manager";
43+ homepage = http://launchpad.net/lightdm;
44+ platforms = platforms.linux;
45+ maintainers = with maintainers; [ abbradar ];
46+ };
47+}
pkgs/top-level/all-packages.nix+4−1
@@ -11449,11 +11449,14 @@ let
1144911449
1145011450 printrun = callPackage ../applications/misc/printrun { };
1145111451
11452+ sddm = callPackage ../applications/display-managers/sddm {
11453+ qt5 = qt54;
11454+ };
11455+
1145211456 slim = callPackage ../applications/display-managers/slim {
1145311457 libpng = libpng12;
1145411458 };
1145511459
11456−
1145711460 smartgithg = callPackage ../applications/version-management/smartgithg { };
1145811461
1145911462 slimThemes = recurseIntoAttrs (import ../applications/display-managers/slim/themes.nix {