From 54d8729e6326c0863afd0c358049647734ba9a73 Mon Sep 17 00:00:00 2001 From: Jane Alesi Date: Wed, 20 May 2026 10:49:07 +0200 Subject: [PATCH] feat: implement hyprland role and package configuration Co-authored-by: Junie --- ansible/roles/hyprland/handlers/main.yml | 4 ++ ansible/roles/hyprland/tasks/main.yml | 73 ++++++++++++++++++++++++ ansible/vars/main.yml | 56 ++++++++++++++++++ ansible/workstation.yml | 5 ++ 4 files changed, 138 insertions(+) create mode 100644 ansible/roles/hyprland/handlers/main.yml create mode 100644 ansible/roles/hyprland/tasks/main.yml diff --git a/ansible/roles/hyprland/handlers/main.yml b/ansible/roles/hyprland/handlers/main.yml new file mode 100644 index 0000000..5346d92 --- /dev/null +++ b/ansible/roles/hyprland/handlers/main.yml @@ -0,0 +1,4 @@ +--- +- name: rebuild initramfs + command: mkinitcpio -P + become: yes diff --git a/ansible/roles/hyprland/tasks/main.yml b/ansible/roles/hyprland/tasks/main.yml new file mode 100644 index 0000000..97da516 --- /dev/null +++ b/ansible/roles/hyprland/tasks/main.yml @@ -0,0 +1,73 @@ +--- +- name: Hyprland - install packages + community.general.pacman: + name: "{{ hyprland_packages }}" + state: present + update_cache: yes + tags: [hyprland, packages] + +- name: Hyprland - ensure configuration directories exist + file: + path: "/home/{{ system_user }}/.config/{{ item }}" + state: directory + owner: "{{ system_user }}" + group: "{{ system_user }}" + mode: '0755' + loop: + - hypr + - waybar + - wofi + - dunst + tags: [hyprland, config] + +- name: Hyprland - configure NVIDIA DRM KMS (modeset=1) + lineinfile: + path: /etc/modprobe.d/nvidia.conf + line: "options nvidia-drm modeset=1" + create: yes + notify: rebuild initramfs + tags: [hyprland, nvidia] + +- name: Hyprland - check if NVIDIA modules are already in mkinitcpio + command: grep -q "nvidia nvidia_modeset nvidia_uvm nvidia_drm" /etc/mkinitcpio.conf + register: mkinitcpio_check + failed_when: false + changed_when: false + tags: [hyprland, nvidia] + +- name: Hyprland - configure early module loading in mkinitcpio + replace: + path: /etc/mkinitcpio.conf + regexp: '^MODULES=\((.*)\)' + replace: 'MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm \1)' + when: mkinitcpio_check.rc != 0 + notify: rebuild initramfs + tags: [hyprland, nvidia] + +- name: Hyprland - register session in SDDM + copy: + dest: /usr/share/wayland-sessions/hyprland.desktop + content: | + [Desktop Entry] + Name=Hyprland + Comment=An intelligent dynamic tiling Wayland compositor + Exec=Hyprland + Type=Application + DesktopNames=Hyprland + tags: [hyprland, session] + +- name: Hyprland - template core configuration + template: + src: "{{ item.src }}" + dest: "/home/{{ system_user }}/.config/{{ item.dest }}" + owner: "{{ system_user }}" + group: "{{ system_user }}" + mode: '0644' + loop: + - { src: 'hyprland.conf.j2', dest: 'hypr/hyprland.conf' } + - { src: 'hyprlock.conf.j2', dest: 'hypr/hyprlock.conf' } + - { src: 'hypridle.conf.j2', dest: 'hypr/hypridle.conf' } + - { src: 'waybar_config.j2', dest: 'waybar/config' } + - { src: 'waybar_style.css.j2', dest: 'waybar/style.css' } + - { src: 'dunstrc.j2', dest: 'dunst/dunstrc' } + tags: [hyprland, config] diff --git a/ansible/vars/main.yml b/ansible/vars/main.yml index ea5e5ae..4d958ef 100644 --- a/ansible/vars/main.yml +++ b/ansible/vars/main.yml @@ -9,3 +9,59 @@ os_type: archlinux pnpm_version: "25.6.1" python_version: "3.14.3" php_version: "8.5.3" + +# --------------------------------------------------------------------------- +# system-upgrade role: kernel + NVIDIA preparation for Hyprland/Wayland +# --------------------------------------------------------------------------- +# Strategy: keep linux618 as fallback, add linux70 (7.0.x stable) +# as the new daily-driver kernel. Migrate NVIDIA from the pinned 575xx branch +# to the 580xx branch (NFB) for Pascal compatibility. +# See: docs/adr/0002-kernel-and-nvidia-strategy.md +kernel_packages: + - linux618 + - linux618-headers + - linux70 + - linux70-headers +nvidia_kernel_modules: + - linux618-nvidia-580xx + - linux70-nvidia-580xx +nvidia_userspace_packages: + - nvidia-580xx-utils + - lib32-nvidia-580xx-utils + - opencl-nvidia-580xx + - nvidia-580xx-settings +nvidia_packages_to_remove: + - linux612-nvidia-575xx + - nvidia-575xx-utils + - lib32-nvidia-575xx-utils + - nvidia-575xx-settings + - opencl-nvidia +# Pre-flight: refuse to proceed if free space on / drops below this many GiB. +# Current usage is ~87% so we keep this conservative. +min_free_root_gb: 5 + +# --------------------------------------------------------------------------- +# hyprland role: packages and configuration +# --------------------------------------------------------------------------- +hyprland_packages: + - hyprland + - hyprlock + - hypridle + - hyprshot + - hyprcursor + - xdg-desktop-portal-hyprland + - waybar + - wofi + - dunst + - kitty + - cliphist + - wl-clipboard + - brightnessctl + - pipewire + - pipewire-pulse + - wireplumber + - pavucontrol + - dolphin + - egl-wayland + - qt5-wayland + - qt6-wayland diff --git a/ansible/workstation.yml b/ansible/workstation.yml index 8c811b9..4260714 100644 --- a/ansible/workstation.yml +++ b/ansible/workstation.yml @@ -8,6 +8,11 @@ - vars/secrets.yml roles: + - role: system-upgrade + tags: [system-upgrade] + when: os_type == 'archlinux' - common - dev-tools - maintenance + - role: hyprland + tags: [hyprland]