blob: cec3e0bf5046250e954b5f6bf6596c3dc50392f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
{ lib
, pkgs
, config
, ...
}:
let
cfg = config.programs.regreet;
settingsFormat = pkgs.formats.toml { };
in
{
options.programs.regreet = {
enable = lib.mkEnableOption null // {
description = ''
Enable ReGreet, a clean and customizable greeter for greetd.
To use ReGreet, {option}`services.greetd` has to be enabled and
{option}`services.greetd.settings.default_session` should contain the
appropriate configuration to launch
{option}`config.programs.regreet.package`. For examples, see the
[ReGreet Readme](https://github.com/rharish101/ReGreet#set-as-default-session).
A minimal configuration that launches ReGreet in {command}`cage` is
enabled by this module by default.
'';
};
package = lib.mkPackageOption pkgs [ "greetd" "regreet" ] { };
settings = lib.mkOption {
type = lib.types.either lib.types.path settingsFormat.type;
default = { };
description = ''
ReGreet configuration file. Refer
<https://github.com/rharish101/ReGreet/blob/main/regreet.sample.toml>
for options.
'';
};
cageArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "-s" ];
example = lib.literalExpression
''
[ "-s" "-m" "last" ]
'';
description = ''
Additional arguments to be passed to
[cage](https://github.com/cage-kiosk/cage).
'';
};
extraCss = lib.mkOption {
type = lib.types.either lib.types.path lib.types.lines;
default = "";
description = ''
Extra CSS rules to apply on top of the GTK theme. Refer to
[GTK CSS Properties](https://docs.gtk.org/gtk4/css-properties.html) for
modifiable properties.
'';
};
theme = {
package = lib.mkPackageOption pkgs "gnome-themes-extra" { } // {
description = ''
The package that provides the theme given in the name option.
'';
};
name = lib.mkOption {
type = lib.types.str;
default = "Adwaita";
description = ''
Name of the theme to use for regreet.
'';
};
};
iconTheme = {
package = lib.mkPackageOption pkgs "adwaita-icon-theme" { } // {
description = ''
The package that provides the icon theme given in the name option.
'';
};
name = lib.mkOption {
type = lib.types.str;
default = "Adwaita";
description = ''
Name of the icon theme to use for regreet.
'';
};
};
font = {
package = lib.mkPackageOption pkgs "cantarell-fonts" { } // {
description = ''
The package that provides the font given in the name option.
'';
};
name = lib.mkOption {
type = lib.types.str;
default = "Cantarell";
description = ''
Name of the font to use for regreet.
'';
};
size = lib.mkOption {
type = lib.types.ints.positive;
default = 16;
description = ''
Size of the font to use for regreet.
'';
};
};
cursorTheme = {
package = lib.mkPackageOption pkgs "adwaita-icon-theme" { } // {
description = ''
The package that provides the cursor theme given in the name option.
'';
};
name = lib.mkOption {
type = lib.types.str;
default = "Adwaita";
description = ''
Name of the cursor theme to use for regreet.
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [
cfg.theme.package
cfg.iconTheme.package
cfg.cursorTheme.package
];
fonts.packages = [ cfg.font.package ];
programs.regreet.settings = {
cursor_theme_name = cfg.cursorTheme.name;
font_name = "${cfg.font.name} ${toString cfg.font.size}";
icon_theme_name = cfg.iconTheme.name;
theme_name = cfg.theme.name;
};
services.greetd = {
enable = lib.mkDefault true;
settings.default_session.command = lib.mkDefault "${pkgs.dbus}/bin/dbus-run-session ${lib.getExe pkgs.cage} ${lib.escapeShellArgs cfg.cageArgs} -- ${lib.getExe cfg.package}";
};
environment.etc = {
"greetd/regreet.css" =
if lib.isPath cfg.extraCss
then {source = cfg.extraCss;}
else {text = cfg.extraCss;};
"greetd/regreet.toml".source =
if lib.isPath cfg.settings
then cfg.settings
else settingsFormat.generate "regreet.toml" cfg.settings;
};
systemd.tmpfiles.settings."10-regreet" = let
defaultConfig = {
user = "greeter";
group = config.users.users.${config.services.greetd.settings.default_session.user}.group;
mode = "0755";
};
in {
"/var/log/regreet".d = defaultConfig;
"/var/cache/regreet".d = defaultConfig;
};
};
}
|