Greetd: Difference between revisions
imported>Onny Initial page |
imported>Onny Add further configuration example |
||
Line 3: | Line 3: | ||
== Usage == | == Usage == | ||
In this minimal example, the Wayland compository [[Sway]] automatically gets executed by the user <code>myuser</code> after successfull boot: | Using this configuration, greetd will use the greeter <code>gtkgreet</code>, 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> | |||
{ 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 -c sway; 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 | |||
''; | |||
} | |||
</nowiki>}} | |||
In this minimal example, the Wayland compository [[Sway]] automatically gets executed by the user <code>myuser</code> after successfull boot, no password required: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
Line 17: | Line 50: | ||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
<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>. |
Revision as of 14:04, 30 May 2022
greetd is a minimal login manager.
Usage
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:
/etc/nixos/configuration.nix
{ 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 -c sway; 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
'';
}
In this minimal example, the Wayland compository Sway automatically gets executed by the user myuser
after successfull boot, no password required:
/etc/nixos/configuration.nix
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
.