1{
2 lib,
3 stdenv,
4 buildPackages,
5 fetchFromGitHub,
6 nix-update-script,
7 replaceVars,
8 plymouth,
9 pam,
10 pkg-config,
11 autoreconfHook,
12 gettext,
13 libtool,
14 libxcb,
15 glib,
16 libXdmcp,
17 itstool,
18 intltool,
19 libxklavier,
20 libgcrypt,
21 audit,
22 busybox,
23 polkit,
24 accountsservice,
25 gtk-doc,
26 gobject-introspection,
27 vala,
28 fetchpatch,
29 withQt5 ? false,
30 qtbase,
31 yelp-tools,
32 yelp-xsl,
33 nixosTests,
34}:
35
36stdenv.mkDerivation rec {
37 pname = "lightdm";
38 version = "1.32.0";
39
40 outputs = [
41 "out"
42 "dev"
43 ];
44
45 src = fetchFromGitHub {
46 owner = "canonical";
47 repo = pname;
48 rev = version;
49 sha256 = "sha256-ttNlhWD0Ran4d3QvZ+PxbFbSUGMkfrRm+hJdQxIDJvM=";
50 };
51
52 nativeBuildInputs = [
53 autoreconfHook
54 gettext
55 yelp-tools
56 yelp-xsl
57 gobject-introspection
58 gtk-doc
59 intltool
60 itstool
61 libtool
62 pkg-config
63 vala
64 ];
65
66 buildInputs = [
67 accountsservice
68 audit
69 glib
70 libXdmcp
71 libgcrypt
72 libxcb
73 libxklavier
74 pam
75 polkit
76 ]
77 ++ lib.optional withQt5 qtbase;
78
79 patches = [
80 # Adds option to disable writing dmrc files
81 (fetchpatch {
82 url = "https://src.fedoraproject.org/rpms/lightdm/raw/4cf0d2bed8d1c68970b0322ccd5dbbbb7a0b12bc/f/lightdm-1.25.1-disable_dmrc.patch";
83 sha256 = "06f7iabagrsiws2l75sx2jyljknr9js7ydn151p3qfi104d1541n";
84 })
85
86 # Hardcode plymouth to fix transitions.
87 # For some reason it can't find `plymouth`
88 # even when it's in PATH in environment.systemPackages.
89 (replaceVars ./fix-paths.patch {
90 plymouth = "${plymouth}/bin/plymouth";
91 })
92
93 # glib gettext is deprecated and broken, so use regular gettext instead
94 ./use-regular-gettext.patch
95 ];
96
97 dontWrapQtApps = true;
98
99 preConfigure = "NOCONFIGURE=1 ./autogen.sh";
100
101 configureFlags = [
102 "--localstatedir=/var"
103 "--sysconfdir=/etc"
104 "--disable-tests"
105 "--disable-dmrc"
106 ]
107 ++ lib.optional withQt5 "--enable-liblightdm-qt5";
108
109 installFlags = [
110 "sysconfdir=${placeholder "out"}/etc"
111 "localstatedir=\${TMPDIR}"
112 ];
113
114 prePatch = ''
115 substituteInPlace autogen.sh \
116 --replace "which" "${buildPackages.busybox}/bin/which"
117
118 substituteInPlace src/shared-data-manager.c \
119 --replace /bin/rm ${busybox}/bin/rm
120 '';
121
122 postInstall = ''
123 rm -rf $out/etc/apparmor.d $out/etc/init $out/etc/pam.d
124 '';
125
126 passthru = {
127 updateScript = nix-update-script { };
128 tests = { inherit (nixosTests) lightdm; };
129 };
130
131 meta = with lib; {
132 homepage = "https://github.com/canonical/lightdm";
133 description = "Cross-desktop display manager";
134 platforms = platforms.linux;
135 license = licenses.gpl3;
136 teams = [ teams.pantheon ];
137 };
138}