commit c2e2ae1a13ef0375a310540e5c9767ac50b2d78c
parent 8deb89e48f022ed59c916b68f5700a203cad453e
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Mon, 7 Jul 2025 16:05:14 +0200
parent 8deb89e48f022ed59c916b68f5700a203cad453e
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Mon, 7 Jul 2025 16:05:14 +0200
config/nixos/modules/services: add `greetd`
3 files changed, 110 insertions(+), 0 deletions(-)
A
|
101
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/config/nixos/modules/presets/graphical/typeNiri.nix b/config/nixos/modules/presets/graphical/typeNiri.nix @@ -24,6 +24,11 @@ in upower.enable = true; power-profiles-daemon.enable = true; swaylock.enable = true; + greetd = { + enable = true; + greeter = lib.mkDefault "tuigreet"; + autoLogin.command = lib.mkDefault "niri-session"; + }; }; };
diff --git a/config/nixos/modules/services/greetd.nix b/config/nixos/modules/services/greetd.nix @@ -0,0 +1,101 @@ +{ + povSelf, + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) types; + cfg = lib.getAttrFromPath povSelf config; + +in +{ + + options = { + enable = { + type = types.bool; + default = false; + }; + greeter = { + type = types.enum [ + "tuigreet" + ]; + default = "tuigreet"; + }; + autoLogin = { + enable = { + type = types.bool; + default = false; + }; + user.type = types.str; + command.type = types.str; + }; + }; + + config = lib.mkIf cfg.enable ( + lib.mkMerge [ + { + security.pam.services.greetd = { + fprintAuth = false; # This would break gnome-keyring auto unlocking + fprintAuthSkipLidClose = false; + enableGnomeKeyring = true; + }; + + services.greetd = { + enable = true; + settings = { + default_session.user = "greeter"; + }; + }; + } + (lib.mkIf cfg.autoLogin.enable { + services.greetd.settings = { + initial_session = { + inherit (cfg.autoLogin) user command; + }; + }; + }) + (lib.mkIf (cfg.greeter == "tuigreet") { + modules.filesystem.impermanence.system.dirs = [ + { + directory = "/var/cache/tuigreet"; + mode = "755"; + user = "greeter"; + group = "greeter"; + } + ]; + + systemd.tmpfiles.settings."greetd" = { + "/var/cache/tuigreet" = { + d = { + mode = "755"; + user = "greeter"; + group = "greeter"; + }; + }; + }; + + services.greetd.settings = { + default_session = { + command = lib.concatStringsSep " " [ + (lib.getExe pkgs.greetd.tuigreet) + "--no-xsession-wrapper" + "--remember" + "--remember-session" + "--time" + "--user-menu" + "--asterisks" + "--power-shutdown" + "'systemctl poweroff'" + "--power-reboot" + "'systemctl reboot'" + ]; + }; + }; + }) + ] + ); + +}
diff --git a/hosts/huntii/default.nix b/hosts/huntii/default.nix @@ -93,6 +93,10 @@ services = { earlyoom.enable = true; systemd-oomd.enable = true; + greetd.autoLogin = { + enable = true; + user = "zaphyra"; + }; }; programs = {