From 7fe5d085fd48af59542df5d03ae95116f0832545 Mon Sep 17 00:00:00 2001 From: Marty Oehme <contact@martyoeh.me> Date: Tue, 25 Feb 2025 22:17:05 +0100 Subject: [PATCH] feat(wayland): Add display manager greetd and greeter tuigreet Sets up a login screen using tuigreet. From there the user is thrown into a shell. Other units/services (usually, the user service `river`) take care to start an actual wayland session for the user. --- books/templates/greetd-config.toml.j2 | 18 +++++++++++++ books/void_wayland.yaml | 37 +++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 books/templates/greetd-config.toml.j2 diff --git a/books/templates/greetd-config.toml.j2 b/books/templates/greetd-config.toml.j2 new file mode 100644 index 0000000..68b2c5d --- /dev/null +++ b/books/templates/greetd-config.toml.j2 @@ -0,0 +1,18 @@ +[terminal] +# The VT to run the greeter on. Can be "next", "current" or a number +# designating the VT. +vt = 7 + +# The default session, also known as the greeter. +[default_session] +command = "tuigreet --cmd zsh" +user = "{{ greeter_user }}" + +# `agreety` is the bundled agetty/login-lookalike. You can replace `/bin/sh` +# with whatever you want started, such as `sway`. +# command = "agreety --cmd /bin/sh" + +# The user to run the command as. The privileges this user must have depends +# on the greeter. A graphical greeter may for example require the user to be +# in the `video` group. +#user = "_greeter" diff --git a/books/void_wayland.yaml b/books/void_wayland.yaml index ab335a1..91c651c 100644 --- a/books/void_wayland.yaml +++ b/books/void_wayland.yaml @@ -39,6 +39,43 @@ - xdg-desktop-portal-wlr state: present +- name: Set up display manager + hosts: target_system + become: true + vars: + greeter_user: _greeter + tags: + - wayland + - greetd + - tuigreet + tasks: + - name: Ensure user group for greeter exists + ansible.builtin.group: + name: "{{ greeter_user }}" + state: present + + - name: Install greetd and tuigreet + community.general.xbps: + name: + - greetd + - tuigreet + state: present + + - name: Set up tuigreet config for greetd + ansible.builtin.template: + src: greetd-config.toml.j2 + dest: "/etc/greetd/config.toml" + owner: root + group: root + mode: 0644 + force: true + + - name: Activate greetd service + ansible.builtin.file: + src: "/etc/sv/greetd" + dest: "/etc/runit/runsvdir/default/greetd" + state: link + - name: Install audio and video for wayland hosts: target_system become: true