desktop.yml
4f953200
 ---
 
 - hosts: 'all'
 
   vars:
     prefix: '{{ ansible_env.HOME }}/.local'
 
   pre_tasks:
 
     ## APT cache update
     - name: 'Update APT'
       become: yes
       apt:
         update_cache: yes
         cache_valid_time: 86400 # One day.
 
     ## APT repository dependencies
     - name: 'Install APT repository dependencies'
       become: yes
       apt:
         name:
           - 'gnupg'
 
     ## APT repositories
     # https://github.com/Airblader/i3/wiki/installation#ubuntu
     # NOTE: This always uses `impish` (Ubuntu 20.10) because newer versions are
     # not available at the time of writing.
     # The URLs at https://regolith-desktop.com/#get-regolith-21 is probably
     # better.
     - name: 'Add APT Regolith repository'
       become: yes
       apt_repository:
         repo: 'ppa:regolith-linux/release'
         codename: 'impish'
 
     ## APT packages
     # TODO: 'manpages-posix' and 'manpages-posix-dev' are in Debian
     # non-free. Do equivalent of `add-apt-repository non-free`?
     - name: 'Install APT packages'
       become: yes
       apt:
         name:
           ### Support files
           - 'locales-all'
           - 'sensible-utils'
           - 'fonts-dejavu'
           - 'fonts-symbola'
           - 'fonts-unifont'
           - 'fonts-font-awesome'
           ### Mail
           - 'mailutils' # Recommends `default-mta`, i.e. `postfix`
           ### Hardware
           - 'xsane'
           # TODO: Break stuff out to benchmarking section?
           - 'sysstat'
           ### I/O
           - 'iozone3'
           #### S.M.A.R.T
           - 'smartmontools'
           - 'smart-notifier'
           - 'gsmartcontrol'
           #### NVMe
           - 'nvme-cli'
           #### Sensors
           # - 'lm-sensors'
           #### Brightness
           - 'brightnessctl'
           - 'brightness-udev'
           #### Video decoding
           - 'libvdpau-va-gl1'
           #### GPU
           # - 'intel-gpu-tools' # `intel_gpu_top`
           - 'radeontop'
           # - 'nvtop'
           #### Power
           # - 'tlp'
           - 'powertop'
           #### Performance
           - 'iotop'
           - 'fio'
           - 'iperf3'
           ### Python
           - 'python3'
           - 'python3-pip'
           - 'python3-venv'
           - 'python3-tk'
           - 'python3-matplotlib'
           - 'python3-numpy'
           - 'python3-scipy'
           # - 'python3-ipython'
           # - 'jupyter'
           # - 'jupyter-qtconsole'
           ### Dotfile dependencies
           - 'git'
           - 'stow'
           # - 'libglib2.0-bin' # `gsettings`
           ### CLI session
           - 'bash'
           ### X session
           - 'xinit'
           - 'i3-gaps-wm'
           - 'compton'
           - 'polybar'
           - 'rofi'
           - 'dunst'
           - 'sxhkd'
           - 'hsetroot'
           - 'mpv'
           ### CLI applications
           - 'apt-file'
           - 'apt-rdepends'
           - 'aptitude'
           - 'tree'
           - 'renameutils'
           - 'moreutils'
           - 'curl'
           - 'jq'
           - 'sshfs'
           - 'autossh'
           # TODO: `git-autofixup` might be better than `git-absorb`
           # (https://news.ycombinator.com/item?id=26501396), but was only
           # introduced in Debian 12 Bookworm, Ubuntu 22.04.
           - 'git-absorb'
           # - 'tig'
           - 'avahi-utils'
           - 'mpc'
           - 'pandoc'
           # - 'timg'
           - 'graphviz'
           - 'par'
           - 'pass'
           # - 'dict-gcide'
           - 'ncal'
           - 'inotify-tools'
           - 'rlwrap'
           - 'adb'
           - 'fdupes'
           - 'pdfgrep'
           # - 'pass-extension-otp'
           # - 'pass-extension-tomb'
           # - 'pass-git-helper'
           ### TUI applications
           - 'vim-gtk3'
           - 'tmux'
           - 'htop'
           # - 'atop'
           # - 'bpytop'
           - 'pulsemixer'
           - 'ncdu'
           - 'ncmpcpp'
           - 'khal'
           ### GUI applications
           - 'xdotool'
           - 'xdg-utils'
           - 'gnome-terminal'
           # - 'xfce4-terminal'
           # - 'kitty' # TODO?
           # - 'firefox'
           - 'vlc'
           - 'gimp'
           - 'inkscape'
           # - 'krita'
           # - 'mypaint'
           # - 'xournal'
           - 'pavucontrol'
           - 'zathura'
           # - 'flameshot'
           - 'screenkey'
           - 'p7zip-full'
           # - 'zeal'
           - 'network-manager-gnome' # `nm-applet`
           # - 'pasystray'
           # - 'xdot' # Use `rcrnstn/xdot.py` pip package instead.
           ### LaTex
           # TODO: Some of these might be redundant.
           - 'texlive'
           - 'texlive-latex-extra'
           - 'texlive-lang-english'
           - 'texlive-lang-european'
           - 'latexmk'
           ### Development
           #### Profiling
           # - 'linux-tools-generic' # `perf`
           - 'valgrind' # valgrind, cachegrind, callgrind
           ##### Visualization
           - 'hotspot'
           - 'kcachegrind'
           # - 'eclipse-tracecompass'
           # - 'uftrace'
           #### Navigation
           - 'exuberant-ctags'
           #### Math
           - 'octave'
           # - 'maxima'
           - 'asymptote' # TODO: https://github.com/cjquines/tsqx
           - 'geogebra'
           #### Shell
           # - 'manpages-posix'
           - 'shellcheck'
           - 'devscripts' # `checkbashisms`
           #### C/C++
           # - 'manpages-posix-dev'
           - 'manpages-dev'
           # - 'libstdc++-11-doc'
           - 'cppman'
           - 'cppreference-doc-en-html'
           - 'gcc'
           - 'g++'
           - 'make'
           - 'cmake'
           - 'cppcheck'
           - 'clang-tidy'
           # Note that apt dependency declaration for `iwyu` might be broken,
           # manually make sure the right version of `clang` is installed.
           - 'iwyu'
           #### OpenGL
           - 'opengl-4-man-doc'
           - 'libgl-dev'
           - 'libglew-dev'
           - 'libglfw3-dev'
           - 'libsdl2-dev'
           # - 'libwxgtk3.0-gtk3-dev'
           - 'libglm-dev'
           - 'libimgui-dev'
           - 'mesa-utils' # `glxinfo`, `glxgears`
           - 'glew-utils' # `glewinfo`
           - 'glbinding-tools' # `glqueries`
           - 'glslang-tools' # `glslangValidator`
           - 'nvidia-cg-toolkit' # `cgc` also does GLSL
           - 'renderdoc'
           - 'apitrace-gui'
           # - 'glmark2' # `glmark2`
           #### OpenCV
           # - 'libopencv-calib3d-dev'
           #### JavaScript
           # - 'libjavascriptcoregtk-4.0-bin'
           - 'nodejs'
           - 'npm'
           ### DevOps
           - 'docker.io'
           - 'docker-compose'
           # - 'virtualbox-qt'
           - 'vagrant'
           - 'vagrant-sshfs'
           - 'ansible'
           - 'ansible-lint'
           ### Android
           - 'scrcpy'
 
     ## Hardware
     - name: 'Add user "{{ ansible_user_id }}" to video and docker groups'
       become: yes
       user:
         name: '{{ ansible_user_id }}'
         groups:
           - 'video'
           - 'docker'
         append: yes
 
     ## Prefix
     - name: 'Create prefix "{{ prefix }}"'
       file:
         path: '{{ prefix }}'
         state: directory
         recurse: yes
 
     ## Dotfiles
     - name: 'Move skeleton dotfiles'
       shell: |
         cd '/etc/skel'
         for path in '.'*
         do
           path="$HOME/$path"
           if [ -e "$path" ] && ! [ -d "$path" ] && ! [ -L "$path" ]
           then
             printf 'Moving "%s" to "%s"\n' "$path" "$path.skel"
             mv "$path" "$path.skel"
           fi
         done
       register: result
       changed_when: result.stdout != ''
 
   roles:
 
     ## Unattended
     # TODO: Using `pre_tasks` above results in `etckeeper` getting installed
     # after all other packages, which might do configuration at install time.
     # We moved to `pre_tasks` from `post_tasks` for a reason...what was it?
     - role: 'unattended'
 
     ## Xsession
     # For Display Managers that don't offer a `/etc/X11/Xsession` natively.
     - role: 'xsession'
 
     ## xwinwrap
     # For `background`.
     - role: 'xwinwrap'
       xwinwrap_prefix: '{{ prefix }}'
 
     ## Home dotfiles
     - role: 'dotfiles'
       dotfiles:
         ### User
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-rcrnstn'
         ### Hardware
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-input'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-pulseaudio'
         ### Session
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-profile'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-path'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-locale'
         ### CLI session
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-sh'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-colors'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-prompt'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-readline'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-bash'
         ### GUI session
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xsession'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xresources'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-i3-gaps'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-compton-picom'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-polybar'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-rofi'
         # - 'https://git.rcrnstn.net/rcrnstn/dotfiles-dunst'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-sxhkd'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xdg-user-dirs'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-recently-used'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-gtk'
         ### CLI applications
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-coreutils'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-diffutils'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-man'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-mpd'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-youtube-dl'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-graphviz'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-stow'
         ### TUI applications
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-less'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-vim'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-tmux'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-ncmpcpp'
         ### GUI applications
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xdg-utils'
         # - 'https://git.rcrnstn.net/rcrnstn/dotfiles-gnome-terminal'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xfce4-terminal'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-firefox'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-zathura'
         ### Development
         #### Git
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-git'
         #### C/C++
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-cmake'
         #### JavaScript
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-nodejs'
         ### DevOps
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-docker'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-virtualbox'
         - 'https://git.rcrnstn.net/rcrnstn/dotfiles-ansible'
 
     ## Prefix dotfiles
     - role: 'dotfiles'
       dotfiles_dir: '{{ prefix }}/stow'
       dotfiles:
         ### GUI session
         - 'https://git.rcrnstn.net/rcrnstn/background'
         ### Development
         #### Git
         - 'https://git.rcrnstn.net/rcrnstn/git-gitolite'
 
     ## Firefox extensions
     - role: 'firefox-extensions'
       firefox_extensions:
         ### Mozilla recommended
         - 'ublock-origin'
         - 'enhancer-for-youtube'
         - 'clearurls'
         - 'tree-style-tab'
         - 'auto-tab-discard'
         - 'turbo-download-manager'
         # - 'https-everywhere'
         # - 'languagetool'
         # - 'styl-us'
         ### Usability
         - 'tridactyl-vim'
         - 'multiple-highlight' # Less permissions than alternatives.
         - 'old-reddit-redirect'
         ### Customizability
         # - 'violentmonkey'
         ### Password management
         # - 'passff'
         # - 'browserpass-ce'
         ### Dictionaries
         # Swedish, linked from
         # https://addons.mozilla.org/en-US/firefox/language-tools/
         - 'görans-hemmasnickrade-ordli'
 
   post_tasks:
 
     ## pip packages
     - name: 'Install pip packages'
       pip:
         extra_args: '--user'
         name:
           - 'pipx'
           # Not installed with `pipx` because the resulting venv does not
           # include PyGObject bindings for GTK3.
           - 'git+https://git.rcrnstn.net/rcrnstn/xdot.py'
 
     ## pipx packages
     - name: 'Install pipx packages'
       community.general.pipx:
         name: '{{ item }}'
       loop:
         # - 'youtube-dl'
         - 'yt-dlp'
         - 'proselint'
         - 'asciinema'
         - 'vim-vint'
         - 'vimgolf'
         - 'git+https://github.com/google/vimdoc'
         - 'git+https://git.rcrnstn.net/rcrnstn/glregistry'
         - 'vosk'
         # - 'openai-whisper'
         # - 'ruff'
 
     ## NPM packages
     - name: 'Install NPM packages'
       community.general.npm:
         name: '{{ item }}'
         global: yes
       environment:
         NPM_CONFIG_PREFIX: '{{ prefix }}'
       loop:
         - 'n'
         - 'svg-term-cli'