Greetd: Difference between revisions
No edit summary |
m Reorganized and added ReGreet |
||
| Line 1: | Line 1: | ||
[https://git.sr.ht/~kennylevinsen/greetd greetd] is a minimal login manager. | [https://git.sr.ht/~kennylevinsen/greetd greetd] is a minimal and flexible login manager daemon. | ||
== | == Greeters == | ||
Using this configuration, greetd will use the greeter | === GTKGreet === | ||
Using this configuration, greetd will use the greeter [https://git.sr.ht/~kennylevinsen/gtkgreet gtkgreet], asking for user, password and which session to start as defined in the <code>/etc/greetd/environments</code> file: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ config, lib, pkgs, ... }: | { config, lib, pkgs, ... }: | ||
| Line 36: | Line 37: | ||
</nowiki>}} | </nowiki>}} | ||
{{note|1=<nowiki/> | |||
If you're hosting gtkgreet in a Wayland compositor, there is a known issue, between GTK portals and dbus, of a delay before the greeter appears,. There are a couple known workarounds depending on the compositor you're using: | |||
* Cage: https://github.com/Hjdskes/cage/issues/169#issuecomment-691659377 | |||
* Sway: https://github.com/swaywm/sway/wiki#gtk-applications-take-20-seconds-to-start | |||
}} | |||
=== ReGreet === | |||
[https://github.com/rharish101/ReGreet ReGreet] is a clean and customizable GTK-based greetd greeter written in Rust. It is meant to be run under a Wayland compositor, such as Sway. Configuration options may be found under [https://search.nixos.org/options?&query=regreet programs.regreet]. | |||
Installation is as simple as enabling it within your configuration. | |||
{{File|3=programs.regreet.enable = true;|name=/etc/nixos/configuration.nix|lang=nix}} | |||
You can also style and configure ReGreet through Nix easily. | |||
{{File|3=programs.regreet = { | |||
enable = true; | |||
# For this example you'd need to have a version of Adwaita and the font Cantarell installed | |||
theme.name = "Adwaita"; | |||
font = { | |||
name = "Cantarell"; | |||
size = 16; | |||
}; | |||
cursorTheme.name = "Adwaita"; | |||
};|name=/etc/nixos/configuration.nix|lang=nix}} | |||
== Automatic startup == | |||
In this minimal example, the Wayland compositor [[Sway]] automatically gets executed by the user <code>myuser</code> after successfull boot, no password required: | In this minimal example, the Wayland compositor [[Sway]] automatically gets executed by the user <code>myuser</code> after successfull boot, no password required: | ||
| Line 52: | Line 81: | ||
<code>initial_session</code> is executed automatically. If you just define <code>default_session</code>, greetd will ask for a password and execute <code>command</code> with user <code>myuser</code>. | <code>initial_session</code> is executed automatically. If you just define <code>default_session</code>, greetd will ask for a password and execute <code>command</code> with user <code>myuser</code>. | ||
[[Category:Wayland]] | [[Category:Wayland]] | ||
Latest revision as of 03:36, 3 January 2026
greetd is a minimal and flexible login manager daemon.
Greeters
GTKGreet
Using this configuration, greetd will use the greeter gtkgreet, asking for user, password and which session to start as defined in the /etc/greetd/environments file:
{ config, lib, pkgs, ... }:
let
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l; swaymsg exit"
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
'';
in
{
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
environment.etc."greetd/environments".text = ''
sway
fish
bash
startxfce4
'';
}
If you're hosting gtkgreet in a Wayland compositor, there is a known issue, between GTK portals and dbus, of a delay before the greeter appears,. There are a couple known workarounds depending on the compositor you're using:
ReGreet
ReGreet is a clean and customizable GTK-based greetd greeter written in Rust. It is meant to be run under a Wayland compositor, such as Sway. Configuration options may be found under programs.regreet.
Installation is as simple as enabling it within your configuration.
programs.regreet.enable = true;
You can also style and configure ReGreet through Nix easily.
programs.regreet = {
enable = true;
# For this example you'd need to have a version of Adwaita and the font Cantarell installed
theme.name = "Adwaita";
font = {
name = "Cantarell";
size = 16;
};
cursorTheme.name = "Adwaita";
};
Automatic startup
In this minimal example, the Wayland compositor Sway automatically gets executed by the user myuser after successfull boot, no password required:
services.greetd = {
enable = true;
settings = rec {
initial_session = {
command = "${pkgs.sway}/bin/sway";
user = "myuser";
};
default_session = initial_session;
};
};
initial_session is executed automatically. If you just define default_session, greetd will ask for a password and execute command with user myuser.