dotfiles/machines/common/linux/greeter.nix

58 lines
1.4 KiB
Nix
Raw Normal View History

{
config,
lib,
pkgs,
...
2024-05-07 18:20:52 +02:00
}:
2024-08-13 01:13:08 +02:00
let
2024-09-08 02:14:51 +02:00
inherit (config.dotfiles) desktop;
2024-08-13 01:13:08 +02:00
condition = (
2024-09-08 02:14:51 +02:00
builtins.elem desktop [
2024-08-13 01:13:08 +02:00
"hyprland"
"sway"
2024-09-08 02:14:51 +02:00
"swayfx"
2024-08-13 01:13:08 +02:00
]
);
2024-09-08 02:14:51 +02:00
binary =
{
swayfx = "sway";
sway = "sway";
hyprland = "hypr";
}
.${desktop} or (throw "greetd: desktop not supported");
2024-08-13 01:13:08 +02:00
in
2024-05-07 18:20:52 +02:00
{
2024-08-13 01:13:08 +02:00
config = lib.mkIf condition {
2024-09-08 02:14:51 +02:00
services.greetd = {
2023-05-19 04:07:58 +02:00
enable = true;
2024-09-08 02:14:51 +02:00
settings.default_session.command = "${lib.getExe pkgs.greetd.tuigreet} --cmd '${pkgs.dbus}/bin/dbus-run-session ${binary}'";
2023-05-19 04:07:58 +02:00
};
2023-12-07 15:40:49 +01:00
services.gnome.gnome-keyring.enable = true;
security.pam.services.greetd = {
2023-05-19 04:07:58 +02:00
enableGnomeKeyring = true;
u2fAuth = true;
};
2023-12-07 15:40:49 +01:00
security.polkit.enable = true;
2023-05-19 04:07:58 +02:00
2023-12-07 15:40:49 +01:00
# start a keyring daemon for sway
systemd = {
2024-05-07 18:20:52 +02:00
packages = [ pkgs.polkit_gnome ];
2023-12-07 15:40:49 +01:00
user.services.polkit-gnome-authentication-agent-1 = {
unitConfig = {
Description = "polkit-gnome-authentication-agent-1";
2024-05-07 18:20:52 +02:00
Wants = [ "graphical-session.target" ];
WantedBy = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
2023-12-07 15:40:49 +01:00
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
};
};
}