@@ -1,54 +1,80 @@
1−{ stdenv, fetchpatch, makeQtWrapper, fetchFromGitHub, cmake, pkgconfig, libxcb, libpthreadstubs
2−, libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd }:
1+{ stdenv, makeQtWrapper, fetchFromGitHub
2+, cmake, pkgconfig, libxcb, libpthreadstubs, lndir
3+, libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd
4+, themes
5+}:
36
47let
58 version = "0.13.0";
6−in
7−stdenv.mkDerivation rec {
8− name = "sddm-${version}";
99
10− src = fetchFromGitHub {
11− owner = "sddm";
12− repo = "sddm";
13− rev = "v${version}";
14− sha256 = "0c3q8lpb123m9k5x3i71mm8lmyzhknw77zxh89yfl8qmn6zd61i1";
15− };
10+ unwrapped = stdenv.mkDerivation rec {
11+ name = "sddm-unwrapped-${version}";
1612
17− patches = [
18− ./0001-ignore-config-mtime.patch
19− ./0002-fix-ConfigReader-QStringList-corruption.patch
20− ];
13+ src = fetchFromGitHub {
14+ owner = "sddm";
15+ repo = "sddm";
16+ rev = "v${version}";
17+ sha256 = "0c3q8lpb123m9k5x3i71mm8lmyzhknw77zxh89yfl8qmn6zd61i1";
18+ };
2119
22− nativeBuildInputs = [ cmake makeQtWrapper pkgconfig qttools ];
20+ patches = [
21+ ./0001-ignore-config-mtime.patch
22+ ./0002-fix-ConfigReader-QStringList-corruption.patch
23+ ];
2324
24− buildInputs = [ libxcb libpthreadstubs libXdmcp libXau qtbase qtdeclarative pam systemd ];
25+ nativeBuildInputs = [ cmake pkgconfig qttools ];
2526
26− cmakeFlags = [
27− "-DCONFIG_FILE=/etc/sddm.conf"
28− # Set UID_MIN and UID_MAX so that the build script won't try
29− # to read them from /etc/login.defs (fails in chroot).
30− # The values come from NixOS; they may not be appropriate
31− # for running SDDM outside NixOS, but that configuration is
32− # not supported anyway.
33− "-DUID_MIN=1000"
34− "-DUID_MAX=29999"
35− ];
27+ buildInputs = [
28+ libxcb libpthreadstubs libXdmcp libXau qtbase qtdeclarative pam systemd
29+ ];
3630
37− preConfigure = ''
38− export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
39− '';
31+ cmakeFlags = [
32+ "-DCONFIG_FILE=/etc/sddm.conf"
33+ # Set UID_MIN and UID_MAX so that the build script won't try
34+ # to read them from /etc/login.defs (fails in chroot).
35+ # The values come from NixOS; they may not be appropriate
36+ # for running SDDM outside NixOS, but that configuration is
37+ # not supported anyway.
38+ "-DUID_MIN=1000"
39+ "-DUID_MAX=29999"
40+ ];
4041
41− postInstall = ''
42− wrapQtProgram $out/bin/sddm
43− wrapQtProgram $out/bin/sddm-greeter
44− '';
42+ preConfigure = ''
43+ export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
44+ '';
4545
46− enableParallelBuilding = true;
46+ enableParallelBuilding = true;
4747
48− meta = with stdenv.lib; {
49− description = "QML based X11 display manager";
50− homepage = https://github.com/sddm/sddm;
51− platforms = platforms.linux;
52− maintainers = with maintainers; [ abbradar ];
48+ meta = with stdenv.lib; {
49+ description = "QML based X11 display manager";
50+ homepage = https://github.com/sddm/sddm;
51+ platforms = platforms.linux;
52+ maintainers = with maintainers; [ abbradar ttuegel ];
53+ };
5354 };
55+
56+in
57+
58+stdenv.mkDerivation {
59+ name = "sddm-${version}";
60+ phases = "installPhase";
61+
62+ nativeBuildInputs = [ lndir makeQtWrapper ];
63+ buildInputs = [ unwrapped ] ++ themes;
64+ inherit themes;
65+ inherit unwrapped;
66+
67+ installPhase = ''
68+ makeQtWrapper "$unwrapped/bin/sddm" "$out/bin/sddm"
69+
70+ mkdir -p "$out/share/sddm"
71+ for pkg in $unwrapped $themes; do
72+ local sddmDir="$pkg/share/sddm"
73+ if [[ -d "$sddmDir" ]]; then
74+ lndir -silent "$sddmDir" "$out/share/sddm"
75+ fi
76+ done
77+ '';
78+
79+ inherit (unwrapped) meta;
5480}