diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-01-24 15:46:51 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-01-24 15:46:51 +0100 |
| commit | 9c9c80f240e45102e8c037feb617c282d4b36479 (patch) | |
| tree | 2a1977cb7bc5aa29101edf8a1746b33a7268d275 /roles/nvidia/tasks/install-archlinux.yml | |
| parent | d7b3463a79a50dc81d28d530c5212a1749efbb15 (diff) | |
Add nvidia driver role w/testing
Fix nvidia role for clean installs and make hyprland nvidia env vars conditional
- Add nouveau blacklist to prevent driver conflicts
- Remove redundant DKMS install task (AUR package handles this automatically)
- Fix mkinitcpio MODULES to append nvidia modules instead of overwriting
- Add missing initramfs rebuild notification to modprobe.d template
- Make hyprland NVIDIA environment variables conditional via hyprland_nvidia flag
Co-authored-by: Claude.ai
Diffstat (limited to 'roles/nvidia/tasks/install-archlinux.yml')
| -rw-r--r-- | roles/nvidia/tasks/install-archlinux.yml | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/roles/nvidia/tasks/install-archlinux.yml b/roles/nvidia/tasks/install-archlinux.yml new file mode 100644 index 00000000..cbcc2221 --- /dev/null +++ b/roles/nvidia/tasks/install-archlinux.yml @@ -0,0 +1,40 @@ +--- +- name: "Install NVIDIA packages" + become: true + ansible.builtin.package: + name: "{{ nvidia_packages }}" + state: "present" + +- name: "Install NVIDIA driver from AUR" + become: true + become_user: "aur_builder" + kewlfft.aur.aur: + name: "{{ nvidia_aur_packages }}" + state: "present" + use: "yay" + +- name: "Configure NVIDIA DRM kernel mode setting" + become: true + ansible.builtin.template: + src: "nvidia.conf.j2" + dest: "/etc/modprobe.d/nvidia.conf" + mode: "0644" + notify: "Rebuild initramfs" + +- name: "Get current mkinitcpio MODULES" + become: true + ansible.builtin.shell: + cmd: "grep '^MODULES=' /etc/mkinitcpio.conf | sed 's/MODULES=(\\(.*\\))/\\1/'" + register: "current_modules" + changed_when: false + +- name: "Add NVIDIA modules to mkinitcpio" + become: true + vars: + existing_modules: "{{ current_modules.stdout.split() | reject('in', nvidia_modules) | list }}" + all_modules: "{{ existing_modules + nvidia_modules }}" + ansible.builtin.lineinfile: + path: "/etc/mkinitcpio.conf" + regexp: "^MODULES=\\(.*\\)" + line: "MODULES=({{ all_modules | join(' ') }})" + notify: "Rebuild initramfs" |
