Browse code

Add implementation

Robert Cranston authored on 22/01/2022 10:19:09
Showing 3 changed files

... ...
@@ -21,6 +21,44 @@ After login, run `startx` to start the graphical environment.
21 21
 [Vagrant provider]: https://www.vagrantup.com/docs/providers
22 22
 [Vagrant box]: https://www.vagrantup.com/docs/boxes
23 23
 
24
+## Requirements
25
+
26
+[Collection][]s:
27
+
28
+-   [`community.general`][]
29
+
30
+[Role][]s:
31
+
32
+-   [`ansible-role-xsession`][]
33
+-   [`ansible-role-xwinwrap`][]
34
+-   [`ansible-role-dotfiles`][]
35
+-   [`ansible-role-firefox-extensions`][]
36
+
37
+Make sure requirements are satisfied by running
38
+
39
+```
40
+ansible-galaxy install -f -r requirements.yml
41
+```
42
+
43
+[collection]: https://docs.ansible.com/ansible/latest/user_guide/collections_using.html
44
+[`community.general`]: https://docs.ansible.com/ansible/latest/collections/community/general/index.html
45
+[role]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html
46
+[`ansible-role-xsession`]: https://git.rcrnstn.net/rcrnstn/ansible-role-xsession
47
+[`ansible-role-xwinwrap`]: https://git.rcrnstn.net/rcrnstn/ansible-role-xwinwrap
48
+[`ansible-role-dotfiles`]: https://git.rcrnstn.net/rcrnstn/ansible-role-dotfiles
49
+[`ansible-role-firefox-extensions`]: https://git.rcrnstn.net/rcrnstn/ansible-role-firefox-extensions
50
+
51
+## Usage
52
+
53
+Run
54
+
55
+```
56
+ansible-playbook -K -i $host, desktop.yml
57
+```
58
+
59
+(note the comma!) replacing `$host` with the host you want to set up (can be
60
+`localhost`, perhaps adding `--connection=local`).
61
+
24 62
 ## License
25 63
 
26 64
 Licensed under the [ISC License][] unless otherwise noted, see the
27 65
new file mode 100644
... ...
@@ -0,0 +1,436 @@
1
+---
2
+
3
+- hosts: 'all'
4
+
5
+  vars:
6
+    prefix: '{{ ansible_env.HOME }}/.local'
7
+
8
+  pre_tasks:
9
+
10
+    ## APT cache update
11
+    - name: 'Update APT'
12
+      become: yes
13
+      apt:
14
+        update_cache: yes
15
+        cache_valid_time: 86400 # One day.
16
+
17
+    ## APT repository dependencies
18
+    - name: 'Install APT repository dependencies'
19
+      become: yes
20
+      apt:
21
+        name:
22
+          - 'gnupg'
23
+
24
+    ## APT repositories
25
+    # https://github.com/Airblader/i3/wiki/installation#ubuntu
26
+    # NOTE: This always uses `impish` (Ubuntu 20.10) because newer versions are
27
+    # not available at the time of writing.
28
+    # The URLs at https://regolith-desktop.com/#get-regolith-21 is probably
29
+    # better.
30
+    - name: 'Add APT Regolith repository'
31
+      become: yes
32
+      apt_repository:
33
+        repo: 'ppa:regolith-linux/release'
34
+        codename: 'impish'
35
+
36
+    ## APT packages
37
+    # TODO: 'manpages-posix' and 'manpages-posix-dev' are in Debian
38
+    # non-free. Do equivalent of `add-apt-repository non-free`?
39
+    - name: 'Install APT packages'
40
+      become: yes
41
+      apt:
42
+        name:
43
+          ### Support files
44
+          - 'locales-all'
45
+          - 'sensible-utils'
46
+          - 'fonts-dejavu'
47
+          - 'fonts-symbola'
48
+          - 'fonts-unifont'
49
+          - 'fonts-font-awesome'
50
+          ### Mail
51
+          - 'mailutils' # Recommends `default-mta`, i.e. `postfix`
52
+          ### Hardware
53
+          - 'xsane'
54
+          # TODO: Break stuff out to benchmarking section?
55
+          - 'sysstat'
56
+          ### I/O
57
+          - 'iozone3'
58
+          #### S.M.A.R.T
59
+          - 'smartmontools'
60
+          - 'smart-notifier'
61
+          - 'gsmartcontrol'
62
+          #### NVMe
63
+          - 'nvme-cli'
64
+          #### Sensors
65
+          # - 'lm-sensors'
66
+          #### Brightness
67
+          - 'brightnessctl'
68
+          - 'brightness-udev'
69
+          #### Video decoding
70
+          - 'libvdpau-va-gl1'
71
+          #### GPU
72
+          # - 'intel-gpu-tools' # `intel_gpu_top`
73
+          - 'radeontop'
74
+          # - 'nvtop'
75
+          #### Power
76
+          # - 'tlp'
77
+          - 'powertop'
78
+          #### Performance
79
+          - 'iotop'
80
+          - 'fio'
81
+          - 'iperf3'
82
+          ### Python
83
+          - 'python3'
84
+          - 'python3-pip'
85
+          - 'python3-venv'
86
+          - 'python3-tk'
87
+          - 'python3-matplotlib'
88
+          - 'python3-numpy'
89
+          - 'python3-scipy'
90
+          # - 'python3-ipython'
91
+          # - 'jupyter'
92
+          # - 'jupyter-qtconsole'
93
+          ### Dotfile dependencies
94
+          - 'git'
95
+          - 'stow'
96
+          # - 'libglib2.0-bin' # `gsettings`
97
+          ### CLI session
98
+          - 'bash'
99
+          ### X session
100
+          - 'xinit'
101
+          - 'i3-gaps-wm'
102
+          - 'compton'
103
+          - 'polybar'
104
+          - 'rofi'
105
+          - 'dunst'
106
+          - 'sxhkd'
107
+          - 'hsetroot'
108
+          - 'mpv'
109
+          ### CLI applications
110
+          - 'apt-file'
111
+          - 'apt-rdepends'
112
+          - 'aptitude'
113
+          - 'tree'
114
+          - 'renameutils'
115
+          - 'moreutils'
116
+          - 'curl'
117
+          - 'jq'
118
+          - 'sshfs'
119
+          - 'autossh'
120
+          # TODO: `git-autofixup` might be better than `git-absorb`
121
+          # (https://news.ycombinator.com/item?id=26501396), but was only
122
+          # introduced in Debian 12 Bookworm, Ubuntu 22.04.
123
+          - 'git-absorb'
124
+          # - 'tig'
125
+          - 'avahi-utils'
126
+          - 'mpc'
127
+          - 'pandoc'
128
+          # - 'timg'
129
+          - 'graphviz'
130
+          - 'par'
131
+          - 'pass'
132
+          # - 'dict-gcide'
133
+          - 'ncal'
134
+          - 'inotify-tools'
135
+          - 'rlwrap'
136
+          - 'adb'
137
+          - 'fdupes'
138
+          - 'pdfgrep'
139
+          # - 'pass-extension-otp'
140
+          # - 'pass-extension-tomb'
141
+          # - 'pass-git-helper'
142
+          ### TUI applications
143
+          - 'vim-gtk3'
144
+          - 'tmux'
145
+          - 'htop'
146
+          # - 'atop'
147
+          # - 'bpytop'
148
+          - 'pulsemixer'
149
+          - 'ncdu'
150
+          - 'ncmpcpp'
151
+          - 'khal'
152
+          ### GUI applications
153
+          - 'xdotool'
154
+          - 'xdg-utils'
155
+          - 'gnome-terminal'
156
+          # - 'xfce4-terminal'
157
+          # - 'kitty' # TODO?
158
+          # - 'firefox'
159
+          - 'vlc'
160
+          - 'gimp'
161
+          - 'inkscape'
162
+          # - 'krita'
163
+          # - 'mypaint'
164
+          # - 'xournal'
165
+          - 'pavucontrol'
166
+          - 'zathura'
167
+          # - 'flameshot'
168
+          - 'screenkey'
169
+          - 'p7zip-full'
170
+          # - 'zeal'
171
+          - 'network-manager-gnome' # `nm-applet`
172
+          # - 'pasystray'
173
+          # - 'xdot' # Use `rcrnstn/xdot.py` pip package instead.
174
+          ### LaTex
175
+          # TODO: Some of these might be redundant.
176
+          - 'texlive'
177
+          - 'texlive-latex-extra'
178
+          - 'texlive-lang-english'
179
+          - 'texlive-lang-european'
180
+          - 'latexmk'
181
+          ### Development
182
+          #### Profiling
183
+          # - 'linux-tools-generic' # `perf`
184
+          - 'valgrind' # valgrind, cachegrind, callgrind
185
+          ##### Visualization
186
+          - 'hotspot'
187
+          - 'kcachegrind'
188
+          # - 'eclipse-tracecompass'
189
+          # - 'uftrace'
190
+          #### Navigation
191
+          - 'exuberant-ctags'
192
+          #### Math
193
+          - 'octave'
194
+          # - 'maxima'
195
+          - 'asymptote' # TODO: https://github.com/cjquines/tsqx
196
+          - 'geogebra'
197
+          #### Shell
198
+          # - 'manpages-posix'
199
+          - 'shellcheck'
200
+          - 'devscripts' # `checkbashisms`
201
+          #### C/C++
202
+          # - 'manpages-posix-dev'
203
+          - 'manpages-dev'
204
+          # - 'libstdc++-11-doc'
205
+          - 'cppman'
206
+          - 'cppreference-doc-en-html'
207
+          - 'gcc'
208
+          - 'g++'
209
+          - 'make'
210
+          - 'cmake'
211
+          - 'cppcheck'
212
+          - 'clang-tidy'
213
+          # Note that apt dependency declaration for `iwyu` might be broken,
214
+          # manually make sure the right version of `clang` is installed.
215
+          - 'iwyu'
216
+          #### OpenGL
217
+          - 'opengl-4-man-doc'
218
+          - 'libgl-dev'
219
+          - 'libglew-dev'
220
+          - 'libglfw3-dev'
221
+          - 'libsdl2-dev'
222
+          # - 'libwxgtk3.0-gtk3-dev'
223
+          - 'libglm-dev'
224
+          - 'libimgui-dev'
225
+          - 'mesa-utils' # `glxinfo`, `glxgears`
226
+          - 'glew-utils' # `glewinfo`
227
+          - 'glbinding-tools' # `glqueries`
228
+          - 'glslang-tools' # `glslangValidator`
229
+          - 'nvidia-cg-toolkit' # `cgc` also does GLSL
230
+          - 'renderdoc'
231
+          - 'apitrace-gui'
232
+          # - 'glmark2' # `glmark2`
233
+          #### OpenCV
234
+          # - 'libopencv-calib3d-dev'
235
+          #### JavaScript
236
+          # - 'libjavascriptcoregtk-4.0-bin'
237
+          - 'nodejs'
238
+          - 'npm'
239
+          ### DevOps
240
+          - 'docker.io'
241
+          - 'docker-compose'
242
+          # - 'virtualbox-qt'
243
+          - 'vagrant'
244
+          - 'vagrant-sshfs'
245
+          - 'ansible'
246
+          - 'ansible-lint'
247
+          ### Android
248
+          - 'scrcpy'
249
+
250
+    ## Hardware
251
+    - name: 'Add user "{{ ansible_user_id }}" to video and docker groups'
252
+      become: yes
253
+      user:
254
+        name: '{{ ansible_user_id }}'
255
+        groups:
256
+          - 'video'
257
+          - 'docker'
258
+        append: yes
259
+
260
+    ## Prefix
261
+    - name: 'Create prefix "{{ prefix }}"'
262
+      file:
263
+        path: '{{ prefix }}'
264
+        state: directory
265
+        recurse: yes
266
+
267
+    ## Dotfiles
268
+    - name: 'Move skeleton dotfiles'
269
+      shell: |
270
+        cd '/etc/skel'
271
+        for path in '.'*
272
+        do
273
+          path="$HOME/$path"
274
+          if [ -e "$path" ] && ! [ -d "$path" ] && ! [ -L "$path" ]
275
+          then
276
+            printf 'Moving "%s" to "%s"\n' "$path" "$path.skel"
277
+            mv "$path" "$path.skel"
278
+          fi
279
+        done
280
+      register: result
281
+      changed_when: result.stdout != ''
282
+
283
+  roles:
284
+
285
+    ## Unattended
286
+    # TODO: Using `pre_tasks` above results in `etckeeper` getting installed
287
+    # after all other packages, which might do configuration at install time.
288
+    # We moved to `pre_tasks` from `post_tasks` for a reason...what was it?
289
+    - role: 'unattended'
290
+
291
+    ## Xsession
292
+    # For Display Managers that don't offer a `/etc/X11/Xsession` natively.
293
+    - role: 'xsession'
294
+
295
+    ## xwinwrap
296
+    # For `background`.
297
+    - role: 'xwinwrap'
298
+      xwinwrap_prefix: '{{ prefix }}'
299
+
300
+    ## Home dotfiles
301
+    - role: 'dotfiles'
302
+      dotfiles:
303
+        ### User
304
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-rcrnstn'
305
+        ### Hardware
306
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-input'
307
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-pulseaudio'
308
+        ### Session
309
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-profile'
310
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-path'
311
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-locale'
312
+        ### CLI session
313
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-sh'
314
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-colors'
315
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-prompt'
316
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-readline'
317
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-bash'
318
+        ### GUI session
319
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xsession'
320
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xresources'
321
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-i3-gaps'
322
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-compton-picom'
323
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-polybar'
324
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-rofi'
325
+        # - 'https://git.rcrnstn.net/rcrnstn/dotfiles-dunst'
326
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-sxhkd'
327
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xdg-user-dirs'
328
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-recently-used'
329
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-gtk'
330
+        ### CLI applications
331
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-coreutils'
332
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-diffutils'
333
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-man'
334
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-mpd'
335
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-youtube-dl'
336
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-graphviz'
337
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-stow'
338
+        ### TUI applications
339
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-less'
340
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-vim'
341
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-tmux'
342
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-ncmpcpp'
343
+        ### GUI applications
344
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xdg-utils'
345
+        # - 'https://git.rcrnstn.net/rcrnstn/dotfiles-gnome-terminal'
346
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-xfce4-terminal'
347
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-firefox'
348
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-zathura'
349
+        ### Development
350
+        #### Git
351
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-git'
352
+        #### C/C++
353
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-cmake'
354
+        #### JavaScript
355
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-nodejs'
356
+        ### DevOps
357
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-docker'
358
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-virtualbox'
359
+        - 'https://git.rcrnstn.net/rcrnstn/dotfiles-ansible'
360
+
361
+    ## Prefix dotfiles
362
+    - role: 'dotfiles'
363
+      dotfiles_dir: '{{ prefix }}/stow'
364
+      dotfiles:
365
+        ### GUI session
366
+        - 'https://git.rcrnstn.net/rcrnstn/background'
367
+        ### Development
368
+        #### Git
369
+        - 'https://git.rcrnstn.net/rcrnstn/git-gitolite'
370
+
371
+    ## Firefox extensions
372
+    - role: 'firefox-extensions'
373
+      firefox_extensions:
374
+        ### Mozilla recommended
375
+        - 'ublock-origin'
376
+        - 'enhancer-for-youtube'
377
+        - 'clearurls'
378
+        - 'tree-style-tab'
379
+        - 'auto-tab-discard'
380
+        - 'turbo-download-manager'
381
+        # - 'https-everywhere'
382
+        # - 'languagetool'
383
+        # - 'styl-us'
384
+        ### Usability
385
+        - 'tridactyl-vim'
386
+        - 'multiple-highlight' # Less permissions than alternatives.
387
+        - 'old-reddit-redirect'
388
+        ### Customizability
389
+        # - 'violentmonkey'
390
+        ### Password management
391
+        # - 'passff'
392
+        # - 'browserpass-ce'
393
+        ### Dictionaries
394
+        # Swedish, linked from
395
+        # https://addons.mozilla.org/en-US/firefox/language-tools/
396
+        - 'görans-hemmasnickrade-ordli'
397
+
398
+  post_tasks:
399
+
400
+    ## pip packages
401
+    - name: 'Install pip packages'
402
+      pip:
403
+        extra_args: '--user'
404
+        name:
405
+          - 'pipx'
406
+          # Not installed with `pipx` because the resulting venv does not
407
+          # include PyGObject bindings for GTK3.
408
+          - 'git+https://git.rcrnstn.net/rcrnstn/xdot.py'
409
+
410
+    ## pipx packages
411
+    - name: 'Install pipx packages'
412
+      community.general.pipx:
413
+        name: '{{ item }}'
414
+      loop:
415
+        # - 'youtube-dl'
416
+        - 'yt-dlp'
417
+        - 'proselint'
418
+        - 'asciinema'
419
+        - 'vim-vint'
420
+        - 'vimgolf'
421
+        - 'git+https://github.com/google/vimdoc'
422
+        - 'git+https://git.rcrnstn.net/rcrnstn/glregistry'
423
+        - 'vosk'
424
+        # - 'openai-whisper'
425
+        # - 'ruff'
426
+
427
+    ## NPM packages
428
+    - name: 'Install NPM packages'
429
+      community.general.npm:
430
+        name: '{{ item }}'
431
+        global: yes
432
+      environment:
433
+        NPM_CONFIG_PREFIX: '{{ prefix }}'
434
+      loop:
435
+        - 'n'
436
+        - 'svg-term-cli'
0 437
new file mode 100644
... ...
@@ -0,0 +1,27 @@
1
+---
2
+
3
+collections:
4
+
5
+  - name: 'community.general'
6
+
7
+roles:
8
+
9
+  - name: 'unattended'
10
+    src: 'https://git.rcrnstn.net/rcrnstn/ansible-role-unattended'
11
+    scm: 'git'
12
+
13
+  - name: 'xsession'
14
+    src: 'https://git.rcrnstn.net/rcrnstn/ansible-role-xsession'
15
+    scm: 'git'
16
+
17
+  - name: 'xwinwrap'
18
+    src: 'https://git.rcrnstn.net/rcrnstn/ansible-role-xwinwrap'
19
+    scm: 'git'
20
+
21
+  - name: 'dotfiles'
22
+    src: 'https://git.rcrnstn.net/rcrnstn/ansible-role-dotfiles'
23
+    scm: 'git'
24
+
25
+  - name: 'firefox-extensions'
26
+    src: 'https://git.rcrnstn.net/rcrnstn/ansible-role-firefox-extensions'
27
+    scm: 'git'