summaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-14 17:24:38 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-14 17:24:38 +0200
commit4f29b6dd05b4826f7a1df57d70537f2dc8d1d8f8 (patch)
tree87a992ea9b0b83730d22194b353036a34d09d205 /roles
parent0e24c6583a159d1e7626cffec25e30f0656f09b8 (diff)
Replace hyprland_nvidia boolean with a fact from the role
This to make the role have less configurations, and less prune to human errors
Diffstat (limited to 'roles')
-rw-r--r--roles/hyprland/defaults/main.yml1
-rw-r--r--roles/hyprland/meta/argument_specs.yml4
-rw-r--r--roles/hyprland/tasks/main.yml7
-rw-r--r--roles/hyprland/templates/uwsm/env.j22
4 files changed, 8 insertions, 6 deletions
diff --git a/roles/hyprland/defaults/main.yml b/roles/hyprland/defaults/main.yml
index 3781ee44..6aec17de 100644
--- a/roles/hyprland/defaults/main.yml
+++ b/roles/hyprland/defaults/main.yml
@@ -1,3 +1,2 @@
---
-hyprland_nvidia: false
hyprland_gdk_scale: 1
diff --git a/roles/hyprland/meta/argument_specs.yml b/roles/hyprland/meta/argument_specs.yml
index d5da1e36..accae13f 100644
--- a/roles/hyprland/meta/argument_specs.yml
+++ b/roles/hyprland/meta/argument_specs.yml
@@ -2,10 +2,6 @@
argument_specs:
main:
options:
- hyprland_nvidia:
- type: "bool"
- default: false
- description: "Enable NVIDIA-specific environment variables for Wayland"
hyprland_gdk_scale:
type: "int"
default: 1
diff --git a/roles/hyprland/tasks/main.yml b/roles/hyprland/tasks/main.yml
index d14b556c..4a64956e 100644
--- a/roles/hyprland/tasks/main.yml
+++ b/roles/hyprland/tasks/main.yml
@@ -1,4 +1,11 @@
---
+- name: "Detect NVIDIA driver"
+ ansible.builtin.command:
+ cmd: "modinfo nvidia"
+ register: "hyprland_nvidia_detected"
+ changed_when: false
+ failed_when: false
+
- name: "Ensure hyprland packages are installed"
become: true
ansible.builtin.package:
diff --git a/roles/hyprland/templates/uwsm/env.j2 b/roles/hyprland/templates/uwsm/env.j2
index f0a03b64..f33b1565 100644
--- a/roles/hyprland/templates/uwsm/env.j2
+++ b/roles/hyprland/templates/uwsm/env.j2
@@ -17,7 +17,7 @@ export MOZ_ENABLE_WAYLAND=1
export ELECTRON_OZONE_PLATFORM_HINT=wayland
export OZONE_PLATFORM=wayland
-{% if hyprland_nvidia %}
+{% if hyprland_nvidia_detected.rc == 0 %}
# NVIDIA Wayland support
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm