From 5027b3dd77d127d383dbfb4824026d0b2576af98 Mon Sep 17 00:00:00 2001 From: Fabio Scotto di Santolo Date: Tue, 12 May 2026 18:33:45 +0200 Subject: [PATCH] Migrate Archlinux config from GRUB to systemd-boot --- AGENTS.md | 1 + ansible/inventory/host_vars/nymph.yml | 25 +++++- .../profile_desktop_host/tasks/nymph.yml | 78 ++++++++++++++++--- 3 files changed, 90 insertions(+), 14 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 48212e5..a23c895 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -68,6 +68,7 @@ Ansible-driven personal infrastructure repo for Void/Arch desktops, Linux workst - `dotfiles/desktop/.local/bin/start-sway-session` - Do not auto-restart `emptty` during playbook runs on active Void desktop hosts; restart it manually from another TTY/SSH session if needed. - `nymph` is an Arch GNOME/GDM desktop; do not route it through Void/i3/Sway/emptty tasks. +- `nymph` uses systemd-boot; keep loader entries and kernel cmdline in `ansible/inventory/host_vars/nymph.yml`. - `profile_desktop_sway` owns the Sway session, Noctalia config rendering, and official plugin linking when a Sway desktop is explicitly enabled. - Noctalia shared config lives in `dotfiles/desktop/.config/noctalia/`; bar monitors and `screenOverrides` come from inventory (`noctalia_bar_monitors`, `noctalia_screen_overrides`) on Sway hosts. - On Sway hosts, `udiskie` is the backend for automount/LUKS but runs without tray; USB device UI is handled by `usb-drive-manager`. diff --git a/ansible/inventory/host_vars/nymph.yml b/ansible/inventory/host_vars/nymph.yml index 81e98e7..2c02e84 100644 --- a/ansible/inventory/host_vars/nymph.yml +++ b/ansible/inventory/host_vars/nymph.yml @@ -7,12 +7,33 @@ desktop_sessions_enabled: desktop_default_session: gnome desktop_default_session_env: wayland -host_grub_cmdline_linux: >- +host_kernel_cmdline: >- rd.luks.uuid=1e15d159-5d05-4a1f-9639-ac200dff9f9c rootflags=subvol=@ apparmor=1 security=apparmor nouveau.modeset=0 nvidia-drm.modeset=1 +host_systemd_boot_esp_path: /boot +host_systemd_boot_default: arch.conf +host_systemd_boot_timeout: 3 +host_systemd_boot_console_mode: max +host_systemd_boot_editor: false +host_systemd_boot_entries: + - filename: arch.conf + title: Arch Linux + linux: /vmlinuz-linux + initrds: + - /intel-ucode.img + - /initramfs-linux.img + options: "{{ host_kernel_cmdline }}" + - filename: arch-fallback.conf + title: Arch Linux fallback + linux: /vmlinuz-linux + initrds: + - /intel-ucode.img + - /initramfs-linux-fallback.img + options: "{{ host_kernel_cmdline }}" + host_packages: - - grub + - intel-ucode - intel-media-driver - libva-intel-driver - mesa diff --git a/ansible/roles/profile_desktop_host/tasks/nymph.yml b/ansible/roles/profile_desktop_host/tasks/nymph.yml index 110fd9a..5d170f2 100644 --- a/ansible/roles/profile_desktop_host/tasks/nymph.yml +++ b/ansible/roles/profile_desktop_host/tasks/nymph.yml @@ -1,21 +1,75 @@ --- -- name: Configure GRUB kernel parameters for NVIDIA hybrid graphics +- name: Ensure systemd-boot loader entries directory exists tags: [packages, nvidia] - ansible.builtin.lineinfile: - path: /etc/default/grub - regexp: '^GRUB_CMDLINE_LINUX=' - line: 'GRUB_CMDLINE_LINUX="{{ host_grub_cmdline_linux }}"' - state: present - register: nymph_grub_cmdline - when: host_grub_cmdline_linux is defined + ansible.builtin.file: + path: "{{ host_systemd_boot_esp_path }}/loader/entries" + state: directory + owner: root + group: root + mode: "0755" + when: host_systemd_boot_esp_path is defined -- name: Regenerate GRUB configuration +- name: Check whether systemd-boot is installed tags: [packages, nvidia] - ansible.builtin.command: grub-mkconfig -o /boot/grub/grub.cfg + ansible.builtin.command: + argv: + - bootctl + - "--esp-path={{ host_systemd_boot_esp_path }}" + - is-installed + register: nymph_systemd_boot_state + changed_when: false + failed_when: false + when: + - host_systemd_boot_esp_path is defined + - not ansible_check_mode + +- name: Install systemd-boot + tags: [packages, nvidia] + ansible.builtin.command: + argv: + - bootctl + - "--esp-path={{ host_systemd_boot_esp_path }}" + - install changed_when: true when: - - host_grub_cmdline_linux is defined - - nymph_grub_cmdline is changed + - host_systemd_boot_esp_path is defined + - not ansible_check_mode + - nymph_systemd_boot_state.rc | default(1) != 0 + +- name: Configure systemd-boot loader defaults + tags: [packages, nvidia] + ansible.builtin.copy: + dest: "{{ host_systemd_boot_esp_path }}/loader/loader.conf" + content: | + default {{ host_systemd_boot_default }} + timeout {{ host_systemd_boot_timeout | default(3) }} + console-mode {{ host_systemd_boot_console_mode | default('max') }} + editor {{ 'yes' if host_systemd_boot_editor | default(false) else 'no' }} + owner: root + group: root + mode: "0644" + when: + - host_systemd_boot_esp_path is defined + - host_systemd_boot_default is defined + +- name: Configure systemd-boot Arch entries + tags: [packages, nvidia] + ansible.builtin.copy: + dest: "{{ host_systemd_boot_esp_path }}/loader/entries/{{ item.filename }}" + content: |- + title {{ item.title }} + linux {{ item.linux }} + {% for initrd in item.initrds | default([]) %} + initrd {{ initrd }} + {% endfor %} + options {{ item.options }} + owner: root + group: root + mode: "0644" + loop: "{{ host_systemd_boot_entries | default([]) }}" + loop_control: + label: "{{ item.filename }}" + when: host_systemd_boot_esp_path is defined - name: Configure NVIDIA power management for hybrid graphics tags: [packages, nvidia]