Refactor for use with Hyprland

This commit is contained in:
Oliver Traber 2024-02-25 20:30:31 +01:00
parent 67f4db010d
commit e38ba9220b
Signed by: Bluemedia
GPG key ID: C0674B105057136C
26 changed files with 457 additions and 398 deletions

View file

@ -0,0 +1,53 @@
- name: Create group for sudoers config
become: yes
group:
name: admins
state: present
- name: Add user to group for sudoers config
become: yes
user:
append: true
name: "{{ ansible_user_id }}"
groups:
- admins
- name: Create sudoers config
become: yes
community.general.sudoers:
name: desktop-environment
group: admins
nopassword: true
commands:
- "/usr/bin/systemctl poweroff"
- "/usr/bin/systemctl reboot"
- "/usr/bin/systemctl suspend"
- name: Copy static config files
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- src: "{{ role_path }}/files/.config"
dest: "{{ ansible_env.HOME }}/"
- name: Ensure presence of required directories
file:
path: "{{ item }}"
recurse: yes
state: directory
loop:
- "{{ ansible_env.HOME }}/.config/hypr"
- "{{ ansible_env.HOME }}/.config/waybar"
- name: Render config files
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- src: "bash_profile.j2"
dest: "{{ ansible_env.HOME }}/.bash_profile"
- src: ".config/hypr/hyprland.conf.j2"
dest: "{{ ansible_env.HOME }}/.config/hypr/hyprland.conf"
- src: ".config/waybar/config.j2"
dest: "{{ ansible_env.HOME }}/.config/waybar/config"

View file

@ -0,0 +1,22 @@
- name: Install flatpak
become: yes
apt:
state: latest
install_recommends: false
name:
- flatpak
- name: Add flathub remote to flatpak
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
method: user
- name: Install flatpaks
community.general.flatpak:
name: "{{ item }}"
state: present
method: user
loop:
- org.wezfurlong.wezterm

View file

@ -0,0 +1,110 @@
- name: Install build dependencies (1/2)
become: yes
apt:
state: build-dep
name:
- wlroots
- name: Install build dependencies (2/2)
become: yes
apt:
state: latest
install_recommends: false
name:
# General
- build-essential
- cmake
- meson
# Hyprland
- libpango1.0-dev
- libtomlplusplus-dev
# xdg-desktop-portal-hyprland
- qtbase5-dev
- libspa-0.2-dev
- libpipewire-0.3-dev
- name: Create source folders
become: yes
file:
path: "/usr/local/src/{{ item }}"
state: directory
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_id }}"
loop:
- "Hyprland"
- "hyprlang"
- "xdg-desktop-portal-hyprland"
- name: Checkout Hyprland repo
ansible.builtin.git:
repo: 'https://github.com/hyprwm/Hyprland.git'
dest: /usr/local/src/Hyprland
version: v0.35.0
force: true
recursive: true
- name: Checkout hyprlang repo
ansible.builtin.git:
repo: 'https://github.com/hyprwm/hyprlang.git'
dest: /usr/local/src/hyprlang
version: v0.4.0
force: true
recursive: true
- name: Checkout xdg-desktop-portal-hyprland repo
ansible.builtin.git:
repo: 'https://github.com/hyprwm/xdg-desktop-portal-hyprland.git'
dest: /usr/local/src/xdg-desktop-portal-hyprland
version: v1.3.1
force: true
recursive: true
- name: Build Hyprland
community.general.make:
chdir: /usr/local/src/Hyprland
target: all
- name: Install Hyprland
become: true
community.general.make:
chdir: /usr/local/src/Hyprland
target: install
- name: Build hyprlang
ansible.builtin.command:
cmd: "{{ item }}"
chdir: /usr/local/src/hyprlang
loop:
- "cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B build"
- "cmake --build build --config Release --target hyprlang"
- name: Install hyprlang
become: yes
ansible.builtin.command:
cmd: "cmake --install build"
chdir: /usr/local/src/hyprlang
- name: Build xdg-desktop-portal-hyprland
ansible.builtin.command:
cmd: "{{ item }}"
chdir: /usr/local/src/xdg-desktop-portal-hyprland
loop:
- "cmake -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib -DCMAKE_INSTALL_PREFIX=/usr -B build"
- "cmake --build build"
- name: Install xdg-desktop-portal-hyprland
become: yes
ansible.builtin.command:
cmd: "cmake --install build"
chdir: /usr/local/src/xdg-desktop-portal-hyprland
- name: Move xdg-desktop-portal-hyprland.service into place
become: yes
ansible.builtin.copy:
src: /usr/lib/x86_64-linux-gnu/systemd/user/xdg-desktop-portal-hyprland.service
dest: /usr/lib/systemd/user/xdg-desktop-portal-hyprland.service
- name: Reload systemd
ansible.builtin.systemd_service:
daemon_reload: true
scope: user

View file

@ -1,93 +1,11 @@
- name: Install packages for desktop environment
become: yes
apt:
state: latest
install_recommends: false
name:
- sway
- xwayland
- swaylock
- waybar
- xdg-desktop-portal-wlr
- slurp
- xfce4-appfinder
- rtkit
- pipewire
- pipewire-pulse
- wireplumber
- alsa-utils
- brightnessctl
- flatpak
- adwaita-icon-theme
- fonts-firacode
- fonts-font-awesome
- fonts-noto-color-emoji
- name: Include installation of Hyprland
import_tasks: hyprland.yml
- name: Add flathub remote to flatpak
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
method: user
- name: Include installation of utilities
import_tasks: utils.yml
- name: Install flatpaks
community.general.flatpak:
name: "{{ item }}"
state: present
method: user
loop:
- org.wezfurlong.wezterm
- name: Include flatpak setup
import_tasks: flatpak.yml
- name: Create group for sudoers config
become: yes
group:
name: admins
state: present
- name: Add user to group for sudoers config
become: yes
user:
append: true
name: "{{ ansible_user_id }}"
groups:
- admins
- name: Create sudoers config
become: yes
community.general.sudoers:
name: desktop-environment
group: admins
nopassword: true
commands:
- "/usr/bin/systemctl poweroff"
- "/usr/bin/systemctl reboot"
- "/usr/bin/systemctl suspend"
- name: Copy static config files
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- src: "{{ role_path }}/files/.config"
dest: "{{ ansible_env.HOME }}/"
- name: Ensure presence of required directories
file:
path: "{{ item }}"
recurse: yes
state: directory
loop:
- "{{ ansible_env.HOME }}/.config/sway"
- "{{ ansible_env.HOME }}/.config/waybar"
- name: Render config files
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
loop:
- src: "bash_profile.j2"
dest: "{{ ansible_env.HOME }}/.bash_profile"
- src: "sway-config.j2"
dest: "{{ ansible_env.HOME }}/.config/sway/config"
- src: "waybar-config.j2"
dest: "{{ ansible_env.HOME }}/.config/waybar/config"
- name: Include configuration steps
import_tasks: config.yml

View file

@ -0,0 +1,25 @@
- name: Install utilities
become: yes
apt:
state: latest
install_recommends: false
name:
- swaylock
- swaybg
- waybar
- xdg-desktop-portal-wlr
- xdg-desktop-portal-gtk
- xfce4-appfinder
- rtkit
- pipewire
- pipewire-pulse
- wireplumber
- qpwgraph
- alsa-utils
- brightnessctl
- gnome-keyring
- adwaita-icon-theme
- fonts-firacode
- fonts-font-awesome
- fonts-noto-color-emoji
- thunar