nix #11

Manually merged
geoffrey merged 113 commits from nix into main 2023-12-09 21:43:01 +01:00
9 changed files with 108 additions and 105 deletions
Showing only changes of commit 634a0b7784 - Show all commits

View file

@ -1,3 +1,4 @@
---
- name: Default
hosts: all
roles:

View file

@ -1,14 +1,11 @@
- name: xrdb-reload
command: "xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main"
- name: i3-reload
command: i3-msg reload
- name: shell-reload
command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
- name: fzf-reload
shell: "source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
- name: qutebrowser-reload
shell: "! pgrep qutebrowser || qutebrowser :config-source"
---
- name: Xrdb-reload
ansible.builtin.command: xrdb -I{{ ansible_env.HOME }} {{ ansible_env.HOME }}/.config/Xresources/main
- name: I3-reload
ansible.builtin.command: i3-msg reload
- name: Shell-reload
ansible.builtin.command: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
- name: Fzf-reload
ansible.builtin.command: source {{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf
- name: Qutebrowser-reload
ansible.builtin.shell: "! pgrep qutebrowser || qutebrowser :config-source"

View file

@ -1,22 +1,24 @@
---
- name: Ensure directories for desktop applications are present
file:
ansible.builtin.file:
state: directory
path: "{{ ansible_user_dir }}/{{ item }}"
mode: "u=rwx,g=rx,o=rx"
mode: u=rwx,g=rx,o=rx
with_items:
- ".config/Xresources"
- ".config/rofi"
- ".local/bin"
- ".local/share/fonts"
- ".config/qutebrowser"
- ".config/tridactyl/themes"
- .config/Xresources
- .config/rofi
- .local/bin
- .local/share/fonts
- .config/qutebrowser
- .config/tridactyl/themes
# Download fonts
- name: Download Nerd fonts
get_url:
url: "https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{ item.filename | urlencode }}"
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/ryanoasis/nerd-fonts/704336735f576781b2a57b12a0c723e3316cbdec/patched-fonts/DejaVuSansMono/{{ item.folder }}/complete/{{
item.filename | urlencode }}
dest: "{{ ansible_user_dir }}/.local/share/fonts/{{ item.filename }}"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
loop:
- filename: DejaVu Sans Mono Bold Nerd Font Complete Mono.ttf
folder: Bold
@ -28,15 +30,16 @@
folder: Italic
- name: Download icon fonts
get_url:
url: "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf"
ansible.builtin.get_url:
url: https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf
dest: "{{ ansible_user_dir }}/.local/share/fonts/fontawesome-webfont.ttf"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
# TODO Either replace with ForkAwesome or Nerd Fonts
- name: Install python dependencies for lemonbar
pip:
ansible.builtin.pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/lemonbar/requirements.txt"
extra_args: --break-system-packages # It's fine, it's local anyways
# Build a single color scheme and template and assign it to a variable
- base16_builder:
@ -58,20 +61,20 @@
- i3
- name: Configure Alacritty
template:
ansible.builtin.template:
src: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml.j2"
dest: "{{ ansible_env.HOME }}/.config/alacritty/alacritty.yml"
mode: "u=rw,g=r,o=r"
# Alacritty has live config reload, so no command to execute
# However, it doesn't work with yaml includes, hence the template
mode: u=rw,g=r,o=r
# Alacritty has live config reload, so no command to execute
# However, it doesn't work with yaml includes, hence the template
tags:
- color
- name: Set base16 theme for Xresources
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['xresources']['xresources']['base16-' + base16_scheme + '-256.Xresources'] }}"
dest: "{{ ansible_env.HOME }}/.config/Xresources/theme"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
notify:
- xrdb-reload
tags:
@ -79,30 +82,30 @@
when: display_server == 'x11'
- name: Download base16 theme for qutebrowser
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['qutebrowser']['themes/minimal']['base16-' + base16_scheme + '.config.py'] }}"
dest: "{{ ansible_env.HOME }}/.config/qutebrowser/theme.py"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
notify:
- qutebrowser-reload
tags:
- color
- name: Download base16 theme for Tridactyl
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
mode: "u=rw,g=r,o=r"
when: False # Not currently used
mode: u=rw,g=r,o=r
when: false # Not currently used
tags:
- color
- name: Configure i3
template:
ansible.builtin.template:
src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
dest: "{{ ansible_env.HOME }}/.config/i3/config"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
notify:
- i3-reload
tags:
@ -111,10 +114,10 @@
when: display_server == 'x11'
- name: Set base16 theme for rofi
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
tags:
- color
loop:
@ -122,49 +125,49 @@
- rasi
- name: Configure Dunst
template:
ansible.builtin.template:
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
dest: "{{ ansible_env.HOME }}/.config/dunst/dunstrc"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
tags:
- color
when: display_server == 'x11'
- name: Download base16 theme for fzf
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['fzf']['bash']['base16-' + base16_scheme + '.config'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApplyFzf"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
notify:
- fzf-reload
tags:
- color
- name: Download base16 theme for shell
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['shell']['script']['base16-' + base16_scheme + '.sh'] }}"
dest: "{{ ansible_env.HOME }}/.local/bin/colorSchemeApply"
mode: "u=rwx,g=rx,o=rx"
mode: u=rwx,g=rx,o=rx
notify:
- shell-reload
when: False # Not currently used
when: false # Not currently used
tags:
- color
- name: Set used base16 theme for vim
copy:
ansible.builtin.copy:
path: "{{ ansible_env.HOME }}/.config/vim/colorscheme.vim"
mode: "u=rw,g=r,o=r"
content: "colorscheme base16-{{ base16_scheme }}"
when: False # Not currently used
mode: u=rw,g=r,o=r
content: colorscheme base16-{{ base16_scheme }}
when: false # Not currently used
tags:
- color
- name: Enable user services
systemd:
ansible.builtin.systemd:
name: "{{ item }}"
state: started
enabled: yes
enabled: true
scope: user
loop:
- pulseaudio

View file

@ -1,3 +1,3 @@
- name: install dotfiles
command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install"
# TODO A python module to do that, so without an handler
---
- name: Install dotfiles
ansible.builtin.command: "{{ ansible_user_dir }}/.dotfiles/config/scripts/dotfiles install"

View file

@ -1,25 +1,26 @@
---
- name: Ensure directories for applications are present
file:
ansible.builtin.file:
state: directory
path: "{{ ansible_user_dir }}/{{ item }}"
mode: "u=rwx,g=rx,o=rx"
mode: u=rwx,g=rx,o=rx
with_items:
- ".cache/zsh"
- ".cache/mpd"
- ".ssh"
- ".local/bin"
- ".ansible/collections/ansible_collections/geoffreyfrogeye"
- .cache/zsh
- .cache/mpd
- .ssh
- .local/bin
- .ansible/collections/ansible_collections/geoffreyfrogeye
- name: Install dotfiles repository
git:
ansible.builtin.git:
repo: "{% if has_forge_access %}git@git.frogeye.fr:{% else %}https://git.frogeye.fr/{% endif %}geoffrey/dotfiles.git"
dest: "{{ ansible_user_dir }}/.dotfiles"
update: yes
update: true
notify: install dotfiles
tags: dotfiles_repo
# TODO Put actual dotfiles in a subdirectory of the repo, so we don't have to put everything in config
- name: Install python dependencies for scripts
pip:
ansible.builtin.pip:
requirements: "{{ ansible_user_dir }}/.dotfiles/config/scripts/requirements.txt"
extra_args: --break-system-packages # It's fine, it's local anyways

View file

@ -1,13 +1,14 @@
---
- name: Load extensions
include_role:
name: "geoffreyfrogeye.{{ extension }}automatrop.entry"
ansible.builtin.include_role:
name: geoffreyfrogeye.{{ extension }}automatrop.entry
loop: "{{ extensions }}"
loop_control:
loop_var: extension
tags: always
- name: Configure extensions rc sourcing
template:
ansible.builtin.template:
src: extrc.sh.j2
dest: "{{ ansible_user_dir }}/.config/shell/extrc"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r

View file

@ -1,11 +1,10 @@
- name: Reload systemd daemon
systemd:
daemon_reload: yes
ansible.builtin.systemd:
daemon_reload: true
listen: systemd changed
become: yes
become: true
- name: Warn about changed Panfrost config
debug:
msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied."
ansible.builtin.debug:
msg: The Panfrost display driver configuration was changed, but needs a reboot to be applied.
listen: panfrost config changed

View file

@ -1,49 +1,49 @@
# Xorg configuration
- name: Check if there is Intel backlight
stat:
ansible.builtin.stat:
path: /sys/class/backlight/intel_backlight
register: intel_backlight
when: display_server == 'x11'
- name: Install Intel video drivers (Arch based)
pacman:
community.general.pacman:
name: xf86-video-intel
# state: "{{ intel_backlight.stat.exists }}"
state: present
become: yes
become: true
when: display_server == 'x11' and intel_backlight.stat.exists and arch_based
# TODO With software role? Would permit other distributions
- name: Configure Xorg Intel backlight
copy:
ansible.builtin.copy:
src: xorg/intel_backlight.conf
dest: "{{ item }}/20-intel_backlight.conf"
become: yes
become: true
when: display_server == 'x11' and intel_backlight.stat.exists
loop: "{{ xorg_common_config_dirs }}"
- name: Configure Xorg joystick behaviour
copy:
ansible.builtin.copy:
src: xorg/joystick.conf
dest: "{{ item }}/50-joystick.conf"
become: yes
become: true
when: display_server == 'x11'
loop: "{{ xorg_common_config_dirs }}"
- name: List modules we're using
slurp:
ansible.builtin.slurp:
src: /proc/modules
register: modules
when: display_server
# Not sure the module will be loaded in early setup stages though
- name: Make panfrost use OpenGL 3.3
lineinfile:
ansible.builtin.lineinfile:
path: /etc/environment
line: 'PAN_MESA_DEBUG="gl3"'
regexp: '^#? ?PAN_MESA_DEBUG='
become: yes
line: PAN_MESA_DEBUG="gl3"
regexp: ^#? ?PAN_MESA_DEBUG=
become: true
when: display_server and using_panfrost
vars:
using_panfrost: "{{ 'panfrost' in (modules.content | b64decode) }}"
@ -51,20 +51,20 @@
# Numlock on boot
- name: set numlock on boot
copy:
- name: Set numlock on boot
ansible.builtin.copy:
src: getty.service
dest: /etc/systemd/system/getty@.service.d/override.conf
become: yes
become: true
notify:
- systemd changed
when: auto_numlock
- name: Unset numlock on boot
file:
ansible.builtin.file:
path: /etc/systemd/system/getty@.service.d/override.conf
state: absent
become: yes
become: true
notify:
- systemd changed
when: not auto_numlock

View file

@ -1,16 +1,17 @@
---
- name: Create Termux directory
file:
ansible.builtin.file:
state: directory
path: "{{ ansible_user_dir }}/.termux"
mode: "u=rwx,g=rx,o=rx"
mode: u=rwx,g=rx,o=rx
# TODO This is a dotfiles directory.
# Make it not install unless it's Termux
- name: Silence Termux login message
file:
ansible.builtin.file:
state: file
path: "{{ ansible_user_dir }}/.hushlogin"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
# Build a single color scheme and template and assign it to a variable
- base16_builder:
@ -22,10 +23,10 @@
- color
- name: Download base16 theme for Termux
copy:
ansible.builtin.copy:
content: "{{ base16_schemes['schemes'][base16_scheme]['termux']['colors']['base16-' + base16_scheme + '.properties'] }}"
dest: "{{ ansible_env.HOME }}/.termux/colors.properties"
mode: "u=rw,g=r,o=r"
mode: u=rw,g=r,o=r
tags:
- color