...
 
Commits (35)
- name: check if package already installed
command: pacman -Qqi {{ pkg }}
ignore_errors: true
changed_when: false
register: installed
- name: build packages
command: aur sync -c {{ pkg }}
register: rc
when: installed is failed
- name: update pacman cache
command: pacman -Sy
when: rc is changed
become: yes
- name: install packages
package:
state: present
name: '{{ pkg }}'
become: yes
when: installed is failed
- hosts: all
tags: base_sys_pkgs
tasks:
- name: install base system packages
package:
state: present
name:
- openssh
- pkgfile
- sudo
when: ansible_os_family == 'Archlinux'
- hosts: all
tags: base
tasks:
- name: add users
user:
state: present
uid: 1000
name: bbguimaraes
group: users
groups: wheel
- name: enable sudoers.d
lineinfile:
state: present
path: /etc/sudoers
validate: visudo -cf %s
line: '#includedir /etc/sudoers.d'
- name: allow wheel to sudo
copy:
dest: /etc/sudoers.d/0_wheel
owner: root
group: root
mode: 0440
validate: visudo -cf %s
content: |
%wheel ALL=(ALL) ALL
- name: update pkgfile
command:
argv: ['pkgfile', '--update']
creates: /var/cache/pkgfile/core.files
when: ansible_os_family == 'Archlinux'
- name: enable and start sshd
service:
enabled: true
state: started
name: sshd
- name: check if the ntp service is enabled
command: timedatectl show --property NTP --value
register: rc
changed_when: False
- name: enable ntp service
command: timedatectl set-ntp yes
when: rc.stdout == "no"
- hosts: all
tags: base_pkgs
vars:
arch_pkgs:
- >-
bash-completion git tmux vim
tasks:
- name: install base packages
package:
name: '{{ (arch_pkgs|join(" ")).split(" ") }}'
when: ansible_os_family == 'Archlinux'
- name: install base packages
package:
name: '{{ (fedora_pkgs|join(" ")).split(" ") + fedora_groups }}'
when: ansible_os_family == 'RedHat'
- hosts: all
tags: base
vars:
home: '{{ ansible_env.HOME }}'
src_dir: '{{ home }}/src'
tasks:
- name: create source directory
file:
state: directory
path: '{{ src_dir }}'
- name: clone dotfiles repository
git:
repo: https://bbguimaraes@github.com/bbguimaraes/dotfiles.git
dest: '{{ src_dir }}/dotfiles'
update: no
- name: create home directories
file:
state: directory
path: '{{ home }}/{{ item }}'
loop:
- .config/git
- name: setup dotfile symlinks
file:
state: link
src: '{{ src_dir }}/dotfiles/{{ item.0 }}'
dest: '{{ home }}/{{ item.1 }}'
loop:
- ['bash/profile', '.bash_profile']
- ['bash/bashrc', '.bashrc']
- ['git/config', '.config/git/config']
- ['bash/inputrc', '.inputrc']
- ['tmux.conf', '.tmux.conf']
- ['vimrc', '.vimrc']
- hosts: all
tags: base_sys_pkgs
tasks:
- name: install base system packages
package:
state: present
name: grub os-prober
when: ansible_os_family == 'Archlinux'
- hosts: all
tags: base_pkgs
vars:
pkgs:
- >- # dev
ansible cloc cmake colordiff ctags emacs gdb git go hub ipython rust tidy
tig
- >- # graphical
chromium dmenu feh gimp i3lock i3status qpdfview redshift
simplescreenrecorder scrot xdotool
- >- # tools
acpi discount ffmpeg inotify-tools msmtp mutt nextcloud-client
offlineimap pass perf poppler ripgrep unrar strace units vdirsyncer
weechat
arch_pkgs:
- >- # dev
base-devel ccache clang devtools distcc encfs llvm podman
python-virtualenv renderdoc shellcheck valgrind
- >- # xorg
mesa xorg xorg-xinit
- >- # graphical
blender firefox gnuplot i3-wm imagemagick inkscape kdenlive
libreoffice-fresh picom rxvt-unicode ttf-dejavu
- >- # audio
alsa-utils ardour audacity hydrogen mpv musescore pavucontrol pulseaudio
pulseaudio-alsa pulseaudio-bluetooth
- >- # tools
android-tools bc bluez bluez-utils jq khal ltrace lynx openbsd-netcat
pacman-contrib pigz pixz pv rlwrap unzip words youtube-dl
- >- # aurutils
expac diffstat pacutils parallel wget
- >- # nngn
boost clinfo emscripten glew glfw-x11 glm intel-compute-runtime
opencl-headers ocl-icd qt5-charts vulkan-intel vulkan-devel
- >- # nngn tests
freeglut glu
fedora_pkgs:
- >- # dev
distcc distcc-server fuse-encfs libcurl-devel patch podman ShellCheck
- >- # graphical
compton i3 libreoffice rxvt-unicode-256color-ml
- >- # tools
passmenu
- >- # work
krb5-workstation pyOpenSSL python-cryptography python-lxml
fedora_groups:
- '@Development tools'
tasks:
- name: enable multilib
blockinfile:
state: present
path: /etc/pacman.conf
marker: '# {mark} ANSIBLE MANAGED BLOCK MULTILIB'
block: |
[multilib]
Include = /etc/pacman.d/mirrorlist
when: ansible_os_family == 'Archlinux'
- name: install base packages
package:
name: '{{ ((pkgs+arch_pkgs)|join(" ")).split(" ") }}'
when: ansible_os_family == 'Archlinux'
- name: install base packages
package:
name: '{{ ((pkgs+fedora_pkgs)|join(" ")).split(" ") + fedora_groups }}'
when: ansible_os_family == 'RedHat'
- hosts: all
tags: networkmanager
tasks:
- name: install package
package:
state: present
name: networkmanager
when: ansible_os_family == 'Archlinux'
- name: enable and start service
service:
enabled: true
state: started
name: NetworkManager
- hosts: all
tags: aurutils
vars:
user: bbguimaraes
aurutils_repo: /var/lib/pacman/aurutils
aurutils_gpg_key: DBE7D3DD8C81D58D0A13D0E76BC26A17B9B7018A
tasks:
- name: create local repository directory
file:
state: directory
path: '{{ aurutils_repo }}'
owner: '{{ user }}'
group: users
- name: unprivileged operations
become: yes
become_user: '{{ user }}'
become_method: su
block:
- name: check if aurutils gpg key is imported
command: gpg2 --list-keys '{{ aurutils_gpg_key }}'
register: rc
ignore_errors: true
changed_when: false
- name: import aurutils gpg key
command: gpg2 --recv-keys '{{ aurutils_gpg_key }}'
when: rc is failed
- name: check if already installed
command: pacman -Qqi aurutils
register: aurutils_installed
ignore_errors: true
changed_when: false
- name: download snapshot
get_url:
url: https://aur.archlinux.org/cgit/aur.git/snapshot/aurutils.tar.gz
dest: /tmp/aurutils.tar.gz
when: aurutils_installed is failed
- name: extract files
unarchive:
src: /tmp/aurutils.tar.gz
dest: /tmp
when: aurutils_installed is failed
- name: makepkg
command:
argv: makepkg
chdir: /tmp/aurutils
creates: /tmp/aurutils/aurutils-*.pkg.tar.xz
when: aurutils_installed is failed
- name: create local repository
command:
argv:
- repo-add
- '{{ aurutils_repo }}/aurutils.db.tar'
creates: '{{ aurutils_repo }}/aurutils.db.tar'
- name: install package
command: pacman --noconfirm -U '{{ item }}'
with_fileglob: /tmp/aurutils/aurutils-*.pkg.tar.xz
when: aurutils_installed is failed
- name: add local repository to pacman.conf
blockinfile:
state: present
path: /etc/pacman.conf
marker: '# {mark} ANSIBLE MANAGED BLOCK AURUTILS'
block: |
[aurutils]
SigLevel = Optional TrustAll
Server = file://{{ aurutils_repo }}
- name: update pacman cache
command: pacman -Sy
- hosts: all
tags: misc
tasks:
- name: disable pulseaudio esound module
replace:
path: /etc/pulse/default.pa
regexp: '^(load-module module-esound-protocol-unix)$'
replace: '#\1'
- hosts: all
tags: brightness
tasks:
- name: copy script
copy:
src: /home/bbguimaraes/n/comp/scripts/brightness.py
dest: /usr/local/bin/brightness
owner: root
group: root
mode: 0755
- name: allow wheel to use it without a password
copy:
dest: /etc/sudoers.d/1_brightness
owner: root
group: root
mode: 0440
validate: visudo -cf %s
content: |
%wheel ALL=(ALL) NOPASSWD: /usr/local/bin/brightness
# Pre-requisites (must be done manually):
# - Password-less ssh access.
# - (Optional, but helpful) configure mirrors.
# - # pacman-key --init
# - # pacman-key --populate archlinuxarm
# - # pacman -Syyu python
# Repurpose the `alarm` user, which has UID 1000 (base.yaml would fail to add
# the default user otherwise):
# - # usermod --login bbguimaraes --home /home/bbguimaraes alarm
# - # mv /home/alarm ~bbguimaraes
# With that done, execute the base.yaml playbook, then this one.
- hosts: all
tasks:
- name: configure locale
lineinfile:
state: present
path: /etc/locale.gen
line: en_US.UTF-8 UTF-8
- name: generate locale
command:
argv: ['locale-gen']
- name: allow wheel to sudo without a password
copy:
dest: /etc/sudoers.d/0_wheel
owner: root
group: root
mode: 0440
validate: visudo -cf %s
content: |
%wheel ALL=(ALL) NOPASSWD: ALL
- hosts: all
tags: base
vars:
home: '{{ ansible_env.HOME }}'
src_dir: '{{ home }}/src'
tasks:
- name: create home directories
file:
state: directory
path: '{{ home }}/{{ item }}'
loop:
- .local/share/tig
- .config/git
- .config/i3
- .config/i3status
- .config/khal
- .config/offlineimap
- .config/tig
- .config/vdirsyncer
- .local/share/subs
- .local/share/systemd/user
- .mutt
- name: setup dotfile symlinks
file:
state: link
src: '{{ src_dir }}/dotfiles/{{ item.0 }}'
dest: '{{ home }}/{{ item.1 }}'
loop:
- ['git/tigrc', '.config/tig/config']
- ['i3/config', '.config/i3/config']
- ['i3/status', '.config/i3status/config']
- ['khal/khal.conf', '.config/khal/config']
- ['khal/vdirsyncer.conf', '.config/vdirsyncer/config']
- ['khal/vdirsyncer.service',
'.local/share/systemd/user/vdirsyncer.service']
- ['khal/vdirsyncer.sh', '.config/vdirsyncer/run.sh']
- ['mutt/msmtprc', '.msmtprc']
- ['mutt/muttrc', '.mutt/muttrc']
- ['mutt/muttrc_gmail', '.mutt/muttrc_gmail']
- ['offlineimap/offlineimap@.service',
'.local/share/systemd/user/offlineimap@.service']
- ['offlineimap/gmail', '.config/offlineimap/gmail']
- ['redshift.conf', '.config/redshift.conf']
- ['user-dirs.dirs', '.config/user-dirs.dirs']
- ['xorg/xinitrc', '.xinitrc']
- ['xorg/Xresources', '.Xresources']
- name: setup other symlinks
file:
state: link
src: '{{ item.0 }}'
dest: '{{ home }}/{{ item.1 }}'
loop:
- ['{{ home }}/src/subs/subs.py', '.local/bin/subs']
- ['{{ home }}/n/subs.sqlite', '.local/share/subs/db']
- ['{{ home }}/n/archive/pass', '.password-store']
- ['{{ home }}/n/archive/mutt.aliases', '.mutt/aliases']
- name: setup CA symlinks (archlinux)
file:
state: link
src: /etc/ssl/certs/ca-certificates.crt
dest: '{{ home }}/{{ item }}'
loop:
- .mutt/tls_trust_file
- .config/offlineimap/tls_trust_file
when: ansible_os_family == 'Archlinux'
- name: setup CA symlinks (fedora)
file:
state: link
src: /etc/ssl/certs/ca-bundle.crt
dest: '{{ home }}/{{ item }}'
loop:
- .mutt/tls_trust_file
- .config/offlineimap/tls_trust_file
when: ansible_os_family == 'RedHat'
- name: ensure files have been created/imported
stat: 'path={{ home }}/{{ item }}'
register: st
failed_when: not st.stat.exists
loop:
- .config/Nextcloud/nextcloud.cfg
- .gnupg/private-keys-v1.d/2BCBD7BC4D16EFE8BB81514BDD139D85894131FF.key
- .gnupg/private-keys-v1.d/2E2E172E019FB7185972C20A9EC30C06B7645832.key
- .gnupg/private-keys-v1.d/80B69EFC5B439D3F744F52E3FF80117C439C7BB2.key
- .gnupg/private-keys-v1.d/E57CD77CA5B02F19F9A7EFE16E263DF6B869D988.key
- .local/share/offlineimap
- .local/share/vdirsyncer
- .password-store
- .ssh/id_rsa
- .ssh/id_rsa.pub
- n
- name: enable and start services
systemd:
enabled: true
state: started
name: '{{ item }}'
scope: user
daemon_reload: true
loop:
- offlineimap@gmail
- redshift
- vdirsyncer
- hosts: all
tags: urxvt
vars:
home: '{{ ansible_env.HOME }}'
tasks:
- name: clone urxvt resize-font plugin
git:
repo: https://github.com/simmel/urxvt-resize-font.git
dest: '{{ home }}/.urxvt/ext/urxvt-resize-font'
- name: add urxvt resize-font symlink
file:
state: link
src: '{{ home }}/.urxvt/ext/urxvt-resize-font/resize-font'
dest: '{{ home }}/.urxvt/ext/resize-font'
- hosts: all
tags: weechat
vars:
dir: '{{ ansible_env.HOME }}/.weechat'
tasks:
- when: ansible_os_family == 'Archlinux'
block:
- name: install weechat-edit-git
import_tasks: aur.yaml
vars: {"pkg": "weechat-edit-git"}
- name: install lua-cjson
import_tasks: aur.yaml
vars: {"pkg": "lua-cjson"}
- name: install weechat-matrix-git
import_tasks: aur.yaml
vars: {"pkg": "weechat-matrix-git"}
- name: create weechat directory
file:
state: directory
path: '{{ dir }}/lua/autoload'
- name: create symlinks
when: ansible_os_family == 'Archlinux'
file:
state: link
src: '{{ item.0 }}'
dest: '{{ dir }}/{{ item.1 }}/autoload/{{ item.2 }}'
loop:
- ['/opt/matrix.lua', 'lua', 'matrix.lua']
- ['/lib/weechat/python/edit.py', 'python', 'edit.py']
- name: set weechat variables
ini_file:
path: '{{ ansible_env.HOME }}/.weechat/{{ item.file }}'
section: '{{ item.section }}'
option: '{{ item.opt }}'
value: '{{ item.val }}'
loop:
- opt: beep.conditions
val: ${tg_displayed}
file: trigger.conf
section: trigger
- file: plugins.conf
section: var
opt: lua.matrix.user
val: bbguimaraes
- file: plugins.conf
section: var
opt: lua.matrix.homeserver_url
val: https://matrix.bbguimaraes.com:8448/
- file: weechat.conf
section: color
opt: separator
val: white
- file: weechat.conf
section: color
opt: status_number
val: white
- file: weechat.conf
section: bar
opt: status.color_bg
val: black
- file: weechat.conf
section: bar
opt: title.color_bg
val: black
- file: buflist.conf
section: format
opt: buffer_current
val: '${format_number}${indent}${color:*white,}${name}'
- hosts: all
name: aur pkgs
tasks:
- when: ansible_os_family == 'Archlinux'
block:
- tags: renderdoc
import_tasks: aur.yaml
vars: {"pkg": "renderdoc"}
- tags: ripcord
import_tasks: aur.yaml
vars: {"pkg": "ripcord"}
- tags: duc
import_tasks: aur.yaml
vars: {"pkg": "duc"}
......@@ -6,3 +6,4 @@
eval "$(dircolors)"
alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
complete -C 'd completion' d
"\C-i": menu-complete
"\e[Z": menu-complete-backward
set show-all-if-ambiguous on
set menu-complete-display-prefix on
......@@ -2,3 +2,4 @@
export VISUAL=vim
export EDITOR=vim
export PATH=$HOME/.local/bin${PATH+:$PATH}
export PASSWORD_STORE_X_SELECTION=primary
// ==UserScript==
// @name github
// @version 1
// @grant none
// @include /https://github\.com/notifications.*/
// ==/UserScript==
let b = document.createElement("button");
b.innerHTML = "open";
b.className = "btn";
b.addEventListener("click", _ =>
document
.querySelectorAll(".notification-list-item-link")
.forEach(x => window.open(x.href)));
document
.querySelector(".js-check-all-container .BtnGroup")
.appendChild(b);
\ No newline at end of file
set show-untracked = false
......@@ -155,7 +155,12 @@ bar {
status_command i3status
}
default_border normal 0
hide_edge_borders both
bindsym $mod+Return exec d urxvt
bindsym $mod+b border toggle
bindsym $mod+g exec d f
bindsym $mod+m exec d displays
bindsym $mod+p exec xdotool search --name mpv key space
bindsym $mod+minus scratchpad show
bindsym $mod+Shift+minus move scratchpad
[calendars]
[[comp]]
path = "~/.local/share/vdirsyncer/nextcloud/comp"
[[birthdays]]
path = "~/.local/share/vdirsyncer/nextcloud/contact_birthdays"
[[calendar]]
path = "~/.local/share/vdirsyncer/nextcloud/defaultcalendar"
[[music]]
path = "~/.local/share/vdirsyncer/nextcloud/music"
[[plan]]
path = "~/.local/share/vdirsyncer/nextcloud/plan"
[[sleep]]
path = "~/.local/share/vdirsyncer/nextcloud/sleep"
[[work]]
path = "~/.local/share/vdirsyncer/nextcloud/work"
[[cal]]
path = "~/.local/share/vdirsyncer/nextcloud/cal"
#!/bin/bash
set -euo pipefail
p=$(pass show nextcloud/cal)
while timeout 5m vdirsyncer sync --force-delete <<< "$p"; do
echo done
sleep 5m
done
p=$(pass show bbguimaraes.com/nextcloud/cal)
while timeout 5m vdirsyncer --verbosity WARNING sync --force-delete <<< "$p"
do sleep 5m; done
......@@ -12,7 +12,7 @@ port 587
account bbgstb@gmail.com : gmail
from bbgstb@gmail.com
user bbgstb
passwordeval pass show google/bbgstb@gmail.com
passwordeval pass show comp/bbgstb@gmail.com
account bbarcaro@redhat.com : gmail
from bbarcaro@redhat.com
......
......@@ -3,9 +3,13 @@ set alias_file = ~/.mutt/aliases
source $alias_file
set header_cache = ~/.cache/mutt
set sort = threads
set delete
set sleep_time = 0
set pager_index_lines = 10
set editor = `echo \$EDITOR`
macro index i '<change-folder>=INBOX<enter>'
color hdrdefault red black
color quoted blue black
color signature blue black
......@@ -17,3 +21,4 @@ color tree white black
color markers red black
color tilde brightmagenta black
color index blue black ~F
color status white blue
......@@ -6,3 +6,5 @@ source ~/.mutt/redhat_mailboxes
set spoolfile = +INBOX
set postponed = +[Gmail]/Drafts
unset record
color status white red
......@@ -28,6 +28,6 @@ remotepasseval = \
('pass', 'show', 'comp/bbgstb@gmail.com'))
holdconnectionopen = yes
keepalive = 60
folderfilter = '[Gmail]/All Mail'.__ne__
folderfilter = lambda x: x not in ('[Gmail]/All Mail', '[Gmail]/Trash')
sslcacertfile = ~/.config/offlineimap/tls_trust_file
ssl_version = tls1_2
[Service]
ExecStart=/usr/bin/offlineimap -c ~/.config/offlineimap/%i
ExecStart=/usr/bin/offlineimap -u quiet -c ~/.config/offlineimap/%i
Restart=always
[Install]
......
......@@ -28,6 +28,6 @@ remotepasseval = \
('pass', 'show', 'redhat/bbarcaro@redhat.com'))
holdconnectionopen = yes
keepalive = 60
folderfilter = '[Gmail]/All Mail'.__ne__
folderfilter = lambda x: x not in ('[Gmail]/All Mail', '[Gmail]/Trash')
sslcacertfile = ~/.config/offlineimap/tls_trust_file
ssl_version = tls1_2
[redshift]
brightness-night=0.5
brightness-night=0.4
location-provider=manual
fade=0
[manual]
lat=49
lon=16
......@@ -5,5 +5,11 @@ bind-key C-a send-prefix
# Set key bindings on copy and choices mode to vi.
set-option -g mode-keys vi
set-option -g allow-rename off
# (Remove) colors.
set-option -g status-style fg=black,bg=white
set-option -g window-style fg=colour250
set-option -g window-active-style fg=brightwhite
set-option -g pane-active-border-style fg=brightwhite
set-option -g pane-border-style fg=colour250
# Toggle synchronize-panes with C-a a.
bind-key a set-window-option synchronize-panes
set nocompatible
set textwidth=79 expandtab tabstop=4 shiftwidth=0 foldminlines=0
set textwidth=79 expandtab tabstop=4 shiftwidth=0 foldminlines=0 scrolloff=0
set backspace=indent,eol,start cpoptions+=$ formatoptions-=o,r nostartofline
set fillchars= laststatus=2 showmode showcmd
......@@ -29,18 +29,30 @@ augroup filetype_mail
\ <leader>mf o--<cr>Bruno Barcarol Guimarães<esc>
augroup END
augroup filetype_opencl
autocmd!
autocmd BufNewFile,BufRead *.cl setlocal filetype=c
augroup END
nnoremap <leader>td :windo setlocal invdiff invscrollbind<cr>
nnoremap <leader>tn :set invnumber<cr>
nnoremap <leader>tp :set invpaste<cr>
nnoremap <leader>ts :call ToggleSyntax()<cr>
nnoremap <leader>tw :set invwrap<cr>
nnoremap <leader>ct :checktime<cr>
nnoremap <leader>ev :vi $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <c-w>t <c-w>s<c-w>T
vnoremap <leader>y :w !xclip<cr>
nnoremap <leader>p :r! xclip -o<cr>
noremap <leader>y :w !xclip<cr>
noremap <leader>cy :w !xclip -selection clipboard<cr>
nnoremap <leader>p :r! xclip -out<cr>
nnoremap <leader>cp :r! xclip -selection clipboard -out<cr>
nnoremap <silent> <leader>o
\ :silent call system("xdg-open " . shellescape(expand("<cWORD>")))<cr>
nnoremap <leader>80 :vertical resize 80<cr>
nnoremap <silent> <leader>rt :%s/\s\+$//<cr>
nnoremap <leader>nc /^<<<<<<< <cr>
nnoremap <leader>nc /^\(<<<<<<< \\|=======\\|>>>>>>> \)<cr>
function! ToggleSyntax()
if exists("g:syntax_on") | syntax off | else | syntax enable | endif
......
......@@ -20,6 +20,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
fi
xset dpms 3600 3600 3600
xset s 3600
feh --bg-max ~/n/archive/bg.png
feh --bg-max ~/n/archive/bg.png --no-fehbg
setxkbmap -option compose:caps
exec i3