Add arch support

This commit is contained in:
Morten Olsen
2024-10-09 21:25:58 +02:00
parent f8c6ffee46
commit c860e8babb
33 changed files with 527 additions and 23 deletions

View File

@@ -1,3 +1,10 @@
---
- name: Info
debug:
msg:
ansible_os_family: "{{ ansible_os_family }}"
ansible_distribution: "{{ ansible_distribution }}"
- name: Setting generic facts
tags: always
ansible.builtin.set_fact:
@@ -5,6 +12,7 @@
home: "/home/alice"
use_become: true
mac_os: "{{ ansible_distribution == 'MacOSX' }}"
archlinux: "{{ ansible_distribution == 'Archlinux' }}"
- name: Setting macos facts
tags: always

View File

@@ -1,2 +1,4 @@
dependencies:
- role: base_info
collections:
- kewlfft.aur

View File

@@ -0,0 +1,27 @@
---
- name: Install dependencies
tags:
- install
become: "{{ use_become }}"
ansible.builtin.package:
name: flatpak
- name: Add the flathub flatpak repository remote to the user installation
become: "{{ use_become }}"
become_user: "{{ username }}"
tags:
- config
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo
method: user
- name: Add the flathub flatpak repository remote
tags:
- config
become: "{{ use_become }}"
community.general.flatpak_remote:
name: flathub
state: present
flatpakrepo_url: https://dl.flathub.org/repo/flathub.flatpakrepo

View File

@@ -23,3 +23,15 @@
path: "{{ home }}"
state: directory
owner: "{{ username }}"
- name: Install yay
tags:
- install
when: archlinux
include_tasks: yay.yml
- name: Install flatpak
tags:
- install
when: archlinux
include_tasks: flatpak.yml

View File

@@ -0,0 +1,21 @@
---
- name: Create the `aur_builder` user
become: yes
ansible.builtin.user:
name: aur_builder
create_home: yes
group: wheel
- name: Allow the `aur_builder` user to run `sudo pacman` without a password
become: yes
ansible.builtin.lineinfile:
path: /etc/sudoers.d/11-install-aur_builder
line: "aur_builder ALL=(ALL) NOPASSWD: /usr/bin/pacman"
create: yes
mode: 0644
validate: "visudo -cf %s"
- name: Yay
aur: name=yay use=makepkg state=present
become: yes
become_user: aur_builder

View File

@@ -0,0 +1,2 @@
---
srcdir: "{{ home }}/.src"

View File

@@ -1,4 +1,5 @@
install_with_root: true
terminal_casks: []
pkgs: []
terminal_pkgs: []
terminal_aur: []
contexts: {}

View File

@@ -2,3 +2,5 @@
dependencies:
- role: base_info
- role: base_system
collections:
- kewlfft.aur

View File

@@ -2,6 +2,7 @@
- name: Setup directories
tags:
- config
become: true
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -14,6 +15,7 @@
when: item.state == 'directory'
- name: Copy config
become: true
tags:
- config
ansible.builtin.copy:

View File

@@ -27,3 +27,12 @@
community.general.homebrew_cask:
name: "{{ terminal_casks }}"
state: installed
- name: "Install aur"
tags:
- install
when: terminal_aur
become: yes
become_user: aur_builder
aur:
name: "{{ terminal_aur }}"

View File

@@ -0,0 +1,15 @@
---
terminal_pkgs:
- bat
- eza
- direnv
- fzf
- gnupg
- jq
- ripgrep
- neovim
- tmux
- zoxide
- sshpass
terminal_aur:
- gh

View File

@@ -23,6 +23,7 @@
- name: "Ensure dir"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.config/dunst"
state: directory
@@ -32,6 +33,7 @@
- name: "Copy templates"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/.config/dunst/{{ item.path | regex_replace('\\.j2$', '') }}"

View File

@@ -20,9 +20,18 @@
ansible.builtin.package:
name: "{{ desktop_hyprland_pkgs }}"
- name: "Install flatpak"
tags:
- install
when: desktop_hyprland_flatpak
become: "{{ install_with_root }}"
community.general.flatpak:
name: "{{ desktop_hyprland_flatpak }}"
- name: "Ensure dir"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.config/hypr"
state: directory
@@ -32,6 +41,7 @@
- name: "Copy templates"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/.config/hypr/{{ item.path | regex_replace('\\.j2$', '') }}"

View File

@@ -4,8 +4,7 @@ $browser = firefox
bind = SUPER, Return, exec, $term
bind = SUPER SHIFT, Return, exec, $browser
bind = SUPER, E, exec, $files
bind = SUPER, D, exec, killall rofi || rofi -show drun -theme ~/.config/rofi/config.rasi
bind = SUPER, period, exec, killall rofi || rofi -show emoji -emoji-format "{emoji}" -modi emoji -theme ~/.config/rofi/global/emoji
bind = SUPER, D, exec, killall wofi || wofi -show drun
bind = SUPER SHIFT, B, exec, killall -SIGUSR2 waybar # Reload waybar
bind = SUPER, B, exec, killall -SIGUSR1 waybar # Hide waybar
@@ -86,4 +85,4 @@ bind = SUPER, mouse_up, workspace, e-1
binde = ,XF86MonBrightnessDown, exec, brightnessctl set 10%-
binde = ,XF86MonBrightnessUp, exec, brightnessctl set 10%+
bind = SUPER, L, exec, systemctl suspend
bind = SUPER CTRL, L, exec, systemctl suspend

View File

@@ -3,3 +3,8 @@ desktop_hyprland_pkgs:
- hyprland
- hyprlock
- swaybg
- wofi
desktop_hyprland_flatpak:
- org.mozilla.firefox
- com.spotify.Client
- com.github.iwalton3.jellyfin-media-player

View File

@@ -15,7 +15,7 @@
- name: "Install dependencies"
tags:
- install
when: desktop_kitty_pks
when: desktop_kitty_pkgs
become: "{{ install_with_root }}"
ansible.builtin.package:
name: "{{ desktop_kitty_pkgs }}"
@@ -23,8 +23,9 @@
- name: "Ensure dir"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.config/dunst"
path: "{{ home }}/.config/kitty"
state: directory
mode: "0700"
owner: "{{ username }}"
@@ -32,6 +33,7 @@
- name: "Copy templates"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/.config/kitty/{{ item.path | regex_replace('\\.j2$', '') }}"

View File

@@ -1,6 +1,7 @@
---
- name: Download atuin
tags: always
become: "{{ use_become }}"
ansible.builtin.get_url:
url: "{{ software_atuin_download_url }}"
dest: "{{ software_atuin_download_dir }}"
@@ -8,6 +9,7 @@
- name: Create dir
tags: always
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ software_atuin_unpack_dir }}"
mode: "0755"
@@ -15,12 +17,15 @@
- name: Unpacking atuin
tags: always
become: "{{ use_become }}"
ansible.builtin.unarchive:
remote_src: true
src: "{{ software_atuin_download_dir }}"
dest: "{{ software_atuin_unpack_dir }}"
- name: Ensure dir
tags: always
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.local/bin"
mode: "0755"
@@ -29,6 +34,7 @@
- name: Move bin
tags: always
become: "{{ use_become }}"
ansible.builtin.copy:
remote_src: true
mode: "0755"
@@ -37,6 +43,7 @@
- name: Cleanup
tags: always
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ software_atuin_unpack_file }}"
state: absent
@@ -44,6 +51,7 @@
- name: Setup config dirctories
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -58,6 +66,7 @@
- name: Copy config {{ context }}
tags:
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"

View File

@@ -13,6 +13,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -28,6 +29,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
@@ -43,6 +45,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "../templates/gitconfig.j2"
dest: "{{ home }}/.gitconfig"

View File

@@ -2,6 +2,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "../templates/gitconfig.context.j2"
dest: "{{ context.path }}/.gitconfig"
@@ -16,6 +17,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ context.path }}"
state: directory
@@ -26,6 +28,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "../templates/sshconfig.context.j2"
dest: "{{ home }}/.ssh/config.d/git-{{ name }}"
@@ -39,6 +42,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.ssh/keys"
state: directory
@@ -49,6 +53,7 @@
tags:
- git
- config
become: "{{ use_become }}"
ansible.builtin.copy:
content: "{{ context.git.signing_key }}"
dest: "{{ home }}/.ssh/keys/github-{{ name }}.pub"

View File

@@ -12,6 +12,7 @@
tags:
- nvim
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -27,6 +28,7 @@
tags:
- nvim
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"
@@ -56,6 +58,7 @@
tags:
- config
- nvim
become: "{{ use_become }}"
ansible.builtin.file:
path: "{{ home }}/.config"
owner: "{{ username }}"
@@ -66,6 +69,7 @@
tags:
- config
- nvim
become: "{{ use_become }}"
ansible.builtin.file:
src: "{{ home }}/Projects/private/nvim"
dest: "{{ home }}/.config/nvim"

View File

@@ -18,19 +18,20 @@
repo: https://github.com/nvm-sh/nvm
dest: "{{ home }}/.nvm"
- name: Install node and set version
tags:
- config
become_user: "{{ username }}"
register: nodeinstall
ansible.builtin.shell: source {{ home }}/.nvm/nvm.sh && nvm install 22
changed_when: "'is already installed' not in nodeinstall.stderr"
args:
executable: /bin/bash
# - name: Install node and set version
# tags:
# - config
# become_user: "{{ username }}"
# register: nodeinstall
# ansible.builtin.shell: source {{ home }}/.nvm/nvm.sh && nvm install 22
# changed_when: "'is already installed' not in nodeinstall.stderr"
# args:
# executable: /bin/bash
- name: Setup config dirctories
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -45,6 +46,7 @@
- name: Copy config {{ context }}
tags:
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"

View File

@@ -1,5 +1,6 @@
---
- name: Ensure dir
become: "{{ use_become }}"
tags:
- config
ansible.builtin.file:
@@ -9,6 +10,7 @@
state: directory
- name: Setup config
become: "{{ use_become }}"
tags:
- config
ansible.builtin.template:

View File

@@ -1,5 +1,6 @@
- name: Download starship
tags: always
become: "{{ use_become }}"
ansible.builtin.get_url:
mode: "0600"
url: "{{ software_starship_download_url }}"
@@ -7,6 +8,7 @@
- name: Create dir
tags: always
become: "{{ use_become }}"
ansible.builtin.file:
mode: "0755"
path: "{{ software_starship_unpack_dir }}"
@@ -14,12 +16,15 @@
- name: Extract starship
tags: always
become: "{{ use_become }}"
ansible.builtin.unarchive:
remote_src: true
src: "{{ software_starship_download_dir }}"
dest: "{{ software_starship_unpack_dir }}"
- name: Ensure dir
tags: always
become: "{{ use_become }}"
ansible.builtin.file:
mode: "0755"
path: "{{ home }}/.local/bin"
@@ -28,6 +33,7 @@
- name: Move bin
tags: always
become: "{{ use_become }}"
ansible.builtin.copy:
remote_src: true
mode: "0755"

View File

@@ -2,6 +2,7 @@
- name: Copy config
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -16,6 +17,7 @@
- name: "Copy templates"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}"
@@ -30,6 +32,7 @@
- name: Copy config
tags:
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"

View File

@@ -18,6 +18,7 @@
- name: Copy config
tags:
- config
become: "{{ use_become }}"
ansible.builtin.file:
mode: "{{ item.mode }}"
path: "{{ home }}/{{ item.path }}"
@@ -32,6 +33,7 @@
- name: "Copy templates"
tags:
- config
become: "{{ use_become }}"
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path | regex_replace('\\.j2$', '') }}"
@@ -46,6 +48,7 @@
- name: Copy config
tags:
- config
become: "{{ use_become }}"
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ home }}/{{ item.path }}"