NixOS configuration 馃獎
1{
2 lib,
3 self,
4 config,
5 pkgs,
6 ...
7}:
8let
9 inherit (lib)
10 mkIf
11 concatStringsSep
12 getExe
13 ;
14
15 inherit (lib.types) enum nullOr;
16 inherit (self.lib.modules) mkOpt;
17
18 sessionData = config.services.displayManager.sessionData.desktops;
19 sessionPath = concatStringsSep ":" [
20 "${sessionData}/share/xsessions"
21 "${sessionData}/share/wayland-sessions"
22 ];
23
24 cfg = config.sylveon.system.loginManager;
25 prof = config.sylveon.profiles;
26in
27{
28 options.sylveon.system.loginManager = mkOpt (nullOr (enum [
29 "greetd"
30 "gdm"
31 ])) (if prof.graphical.enable then "greetd" else null) "The login manager used by the system";
32
33 config = {
34 services.greetd = mkIf (cfg == "greetd") {
35 enable = true;
36
37 settings = {
38 default_session = {
39 user = "greeter";
40 command = concatStringsSep " " [
41 (getExe pkgs.tuigreet)
42 "--time"
43 "--asterisks"
44 "--sessions '${sessionPath}'"
45 ];
46 };
47 };
48 };
49
50 services.displayManager.gdm.enable = (cfg == "gdm");
51 };
52}