mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
111 lines
3.5 KiB
YAML
111 lines
3.5 KiB
YAML
---
|
|
- name: Ensure systemd-boot loader entries directory exists
|
|
tags: [packages, nvidia]
|
|
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: Check whether systemd-boot is installed
|
|
tags: [packages, nvidia]
|
|
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_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]
|
|
ansible.builtin.copy:
|
|
dest: /etc/modprobe.d/nvidia-power-management.conf
|
|
content: |
|
|
options nvidia "NVreg_DynamicPowerManagement=0x02"
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
|
|
- name: Install prime-run wrapper script for NVIDIA PRIME offload
|
|
tags: [nvidia, dotfiles, dotfiles:host]
|
|
ansible.builtin.copy:
|
|
src: "{{ playbook_dir }}/../dotfiles/nymph/.local/bin/prime-run"
|
|
dest: "{{ user_home }}/.local/bin/prime-run"
|
|
owner: "{{ username }}"
|
|
group: "{{ user_group }}"
|
|
mode: "0755"
|
|
force: false
|
|
|
|
- name: Wrap alacritty with prime-run for NVIDIA PRIME offload
|
|
tags: [nvidia, dotfiles, dotfiles:desktop, dotfiles:host]
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ user_home }}/.config/i3/config"
|
|
regexp: '^bindsym \$mod\+Return exec --no-startup-id /usr/bin/alacritty'
|
|
line: 'bindsym $mod+Return exec --no-startup-id ~/.local/bin/prime-run /usr/bin/alacritty'
|
|
when: "'i3' in (desktop_sessions_enabled | default([]))"
|
|
|
|
- name: Deploy WirePlumber camera priority config
|
|
tags: [dotfiles, dotfiles:host]
|
|
ansible.builtin.copy:
|
|
src: "{{ playbook_dir }}/../dotfiles/nymph/.config/wireplumber/wireplumber.conf.d/60-camera-priority.conf"
|
|
dest: "{{ user_home }}/.config/wireplumber/wireplumber.conf.d/60-camera-priority.conf"
|
|
owner: "{{ username }}"
|
|
group: "{{ user_group }}"
|
|
mode: "0644"
|
|
force: true
|