1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8with lib;
9
10let
11
12 dmcfg = config.services.xserver.displayManager;
13 ldmcfg = dmcfg.lightdm;
14 cfg = ldmcfg.greeters.tiny;
15
16in
17{
18 options = {
19
20 services.xserver.displayManager.lightdm.greeters.tiny = {
21
22 enable = mkOption {
23 type = types.bool;
24 default = false;
25 description = ''
26 Whether to enable lightdm-tiny-greeter as the lightdm greeter.
27
28 Note that this greeter starts only the default X session.
29 You can configure the default X session using
30 [](#opt-services.displayManager.defaultSession).
31 '';
32 };
33
34 label = {
35 user = mkOption {
36 type = types.str;
37 default = "Username";
38 description = ''
39 The string to represent the user_text label.
40 '';
41 };
42
43 pass = mkOption {
44 type = types.str;
45 default = "Password";
46 description = ''
47 The string to represent the pass_text label.
48 '';
49 };
50 };
51
52 extraConfig = mkOption {
53 type = types.lines;
54 default = "";
55 description = ''
56 Section to describe style and ui.
57 '';
58 };
59
60 };
61
62 };
63
64 config = mkIf (ldmcfg.enable && cfg.enable) {
65
66 services.xserver.displayManager.lightdm.greeters.gtk.enable = false;
67
68 services.xserver.displayManager.lightdm.greeter =
69 let
70 configHeader = ''
71 #include <gtk/gtk.h>
72 static const char *user_text = "${cfg.label.user}";
73 static const char *pass_text = "${cfg.label.pass}";
74 static const char *session = "${dmcfg.defaultSession}";
75 '';
76 config = optionalString (cfg.extraConfig != "") (configHeader + cfg.extraConfig);
77 package = pkgs.lightdm-tiny-greeter.override { conf = config; };
78 in
79 mkDefault {
80 package = package.xgreeters;
81 name = "lightdm-tiny-greeter";
82 };
83
84 assertions = [
85 {
86 assertion = dmcfg.defaultSession != null;
87 message = ''
88 Please set: services.displayManager.defaultSession
89 '';
90 }
91 ];
92
93 };
94}