aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugene@desktop.midcoip.net>2022-05-08 09:34:19 -0500
committerEugene Triguba <eugene@desktop.midcoip.net>2022-05-08 09:34:19 -0500
commit53205809e426d06eee009f4415798c9dd068807c (patch)
treec1a3055c0a0adc23ea0d01cd5fbc7d4307e080ba
downloaddotfiles-53205809e426d06eee009f4415798c9dd068807c.zip
Initial Commit
-rw-r--r--README.md9
-rw-r--r--ansible/setup.yaml46
-rw-r--r--ansible/tasks/desktop.yaml24
-rw-r--r--ansible/tasks/link_dotfiles.yaml11
-rw-r--r--ansible/tasks/packages.yaml19
-rw-r--r--ansible/vars/desktop.yaml15
-rw-r--r--ansible/vars/dotfiles.yaml26
-rw-r--r--ansible/vars/pkg.yaml42
-rw-r--r--configs/desktop/boot/loader.conf21
-rw-r--r--configs/desktop/etc/rc.conf27
-rw-r--r--configs/desktop/home/.xinitrc2
-rw-r--r--configs/shared/.gdbinit1
-rw-r--r--configs/shared/.gitconfig20
-rw-r--r--configs/shared/.tmux.conf1
-rw-r--r--configs/shared/.vimrc52
-rw-r--r--configs/shared/.zshrc73
-rw-r--r--configs/shared/alacritty.yml11
-rwxr-xr-xinstall41
18 files changed, 441 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6fb0965
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# Dotfiles
+
+```
+$ git clone git@github.com:eugenetriguba/dotfiles.git
+$ cd dotfiles
+$ chmod +x install
+$ ./install
+```
+
diff --git a/ansible/setup.yaml b/ansible/setup.yaml
new file mode 100644
index 0000000..e05cd10
--- /dev/null
+++ b/ansible/setup.yaml
@@ -0,0 +1,46 @@
+---
+- name: Playbook to manage personal dotfiles
+ hosts: localhost
+ connection: local
+ tasks:
+ - name: Create folders
+ file:
+ path: "{{item}}"
+ state: directory
+ loop:
+ - "$HOME/.config/i3"
+ - "$HOME/.config/alacritty"
+ - "$HOME/.config/nvim/autoload"
+ - "$HOME/src"
+ - "$HOME/bin"
+
+ - include_tasks: tasks/link_dotfiles.yaml
+ tags:
+ - links
+
+ - include_tasks: tasks/packages.yaml
+ tags:
+ - packages
+
+ - include_tasks: tasks/desktop.yaml
+ tags:
+ - desktop
+
+ - name: Ensure shell is set to zsh
+ vars:
+ current_user: "{{ ansible_user_id }}"
+ become: yes
+ become_method: su
+ user:
+ name: "{{ current_user }}"
+ shell: /usr/local/bin/zsh
+
+ - name: Install vim-plug
+ command: >
+ wget \
+ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \
+ -P "$HOME/.config/nvim/autoload"
+
+ - name: Install vim-plug plugins
+ shell: nvim +PlugInstall +qall --headless
+
diff --git a/ansible/tasks/desktop.yaml b/ansible/tasks/desktop.yaml
new file mode 100644
index 0000000..9992648
--- /dev/null
+++ b/ansible/tasks/desktop.yaml
@@ -0,0 +1,24 @@
+---
+- name: Include desktop files
+ include_vars: vars/desktop.yaml
+
+- name: Link user files
+ file:
+ src: "{{ item.value.src }}"
+ dest: "{{ item.value.dest }}"
+ state: link
+ with_dict: "{{user_desktop_files}}"
+
+
+- name: Link system files
+ become: true
+ become_method: su
+ copy:
+ src: "{{ item.value.src }}"
+ dest: "{{ item.value.dest }}"
+ backup: yes
+ owner: root
+ group: wheel
+ mode: u=rw,g=r,o=r
+ with_dict: "{{system_desktop_files}}"
+
diff --git a/ansible/tasks/link_dotfiles.yaml b/ansible/tasks/link_dotfiles.yaml
new file mode 100644
index 0000000..bf2f5d0
--- /dev/null
+++ b/ansible/tasks/link_dotfiles.yaml
@@ -0,0 +1,11 @@
+---
+- name: Include dotfiles
+ include_vars: vars/dotfiles.yaml
+
+- name: Link shared dotfiles
+ file:
+ src: "{{ item.value.src }}"
+ dest: "{{ item.value.dest }}"
+ state: link
+ with_dict: "{{dotfiles}}"
+
diff --git a/ansible/tasks/packages.yaml b/ansible/tasks/packages.yaml
new file mode 100644
index 0000000..7f117dc
--- /dev/null
+++ b/ansible/tasks/packages.yaml
@@ -0,0 +1,19 @@
+---
+- name: Include FreeBSD packages
+ include_vars: vars/pkg.yaml
+ tags:
+ - pkg
+
+- block:
+ - name: Install packages
+ become: yes
+ become_method: su
+ when: ansible_os_family == "FreeBSD"
+ with_dict: "{{pkg}}"
+ tags:
+ - pkg
+
+ community.general.pkgng:
+ name: "{{ item.key }}"
+ state: "{{ item.value.state | default('present') }}"
+
diff --git a/ansible/vars/desktop.yaml b/ansible/vars/desktop.yaml
new file mode 100644
index 0000000..f3b0345
--- /dev/null
+++ b/ansible/vars/desktop.yaml
@@ -0,0 +1,15 @@
+---
+user_desktop_files:
+ xinitrc:
+ src: "{{playbook_dir}}/../configs/desktop/home/.xinitrc"
+ dest: "{{ lookup('env', 'HOME') }}/.xinitrc"
+
+system_desktop_files:
+ etc-rc:
+ src: "{{playbook_dir}}/../configs/desktop/etc/rc.conf"
+ dest: "/etc/rc.conf"
+
+ boot-loader:
+ src: "{{playbook_dir}}/../configs/desktop/boot/loader.conf"
+ dest: "/boot/loader.conf"
+
diff --git a/ansible/vars/dotfiles.yaml b/ansible/vars/dotfiles.yaml
new file mode 100644
index 0000000..66d0aeb
--- /dev/null
+++ b/ansible/vars/dotfiles.yaml
@@ -0,0 +1,26 @@
+---
+dotfiles:
+ zshrc:
+ src: "{{playbook_dir}}/../configs/shared/.zshrc"
+ dest: "{{ lookup('env', 'HOME') }}/.zshrc"
+
+ gitconfig:
+ src: "{{playbook_dir}}/../configs/shared/.gitconfig"
+ dest: "{{ lookup('env', 'HOME') }}/.gitconfig"
+
+ gdbinit:
+ src: "{{playbook_dir}}/../configs/shared/.gdbinit"
+ dest: "{{ lookup('env', 'HOME') }}/.gdbinit"
+
+ vimrc:
+ src: "{{playbook_dir}}/../configs/shared/.vimrc"
+ dest: "{{ lookup('env', 'HOME') }}/.config/nvim/init.vim"
+
+ tmux:
+ src: "{{playbook_dir}}/../configs/shared/.tmux.conf"
+ dest: "{{ lookup('env', 'HOME') }}/.tmux.conf"
+
+ alacritty:
+ src: "{{playbook_dir}}/../configs/shared/alacritty.yml"
+ dest: "{{ lookup('env', 'HOME') }}/.config/alacritty/alacritty.yml"
+
diff --git a/ansible/vars/pkg.yaml b/ansible/vars/pkg.yaml
new file mode 100644
index 0000000..ed94045
--- /dev/null
+++ b/ansible/vars/pkg.yaml
@@ -0,0 +1,42 @@
+---
+pkg:
+ 1password-client2:
+ audio/virtual_oss:
+ alacritty:
+ brlaser:
+ devcpu-data:
+ devel/xdg-user-dirs:
+ dmenu:
+ drm-kmod:
+ editors/vim:
+ editors/vscode:
+ en-freebsd-doc:
+ feh:
+ firefox:
+ fzf:
+ git:
+ go:
+ hack-font:
+ i3-gaps:
+ i3lock:
+ i3status:
+ jq:
+ neovim:
+ openssl:
+ pfetch:
+ pkg:
+ poudriere:
+ editors/py-pynvim:
+ python:
+ redshift:
+ ripgrep:
+ rsync:
+ rust-analyzer:
+ scrot:
+ spotify-tui:
+ spotifyd:
+ wget:
+ x11/xclip:
+ x11/xorg:
+ zsh:
+
diff --git a/configs/desktop/boot/loader.conf b/configs/desktop/boot/loader.conf
new file mode 100644
index 0000000..0305c24
--- /dev/null
+++ b/configs/desktop/boot/loader.conf
@@ -0,0 +1,21 @@
+aesni_load="YES"
+cryptodev_load="YES"
+geom_eli_load="YES"
+kern.geom.label.disk_ident.enable="0"
+kern.geom.label.gptid.enable="0"
+security.bsd.allow_destructive_dtrace=0
+zfs_load="YES"
+ng_ubt_load="YES"
+cuse_load="YES"
+
+# Intel Microcore
+cpu_microcode_load="YES"
+cpu_microcode_name="/boot/firmware/intel-ucode.bin"
+
+# Wireless
+if_iwm_load="YES"
+iwm9260fw_load="YES"
+
+# Boot
+autoboot_delay="5"
+
diff --git a/configs/desktop/etc/rc.conf b/configs/desktop/etc/rc.conf
new file mode 100644
index 0000000..fd5d121
--- /dev/null
+++ b/configs/desktop/etc/rc.conf
@@ -0,0 +1,27 @@
+clear_tmp_enable="YES"
+syslogd_flags="-ss"
+sendmail_enable="NONE"
+hostname="desktop"
+ifconfig_em0="DHCP"
+ifconfig_em0_ipv6="inet6 accept_rtadv"
+local_unbound_enable="YES"
+sshd_enable="YES"
+ntpd_enable="YES"
+powerd_enable="YES"
+dumpdev="AUTO"
+zfs_enable="YES"
+keymap="us.kbd"
+jail_enable="YES"
+
+dbus_enable="YES"
+hald_enable="YES"
+
+kld_list="/boot/modules/i915kms.ko"
+
+# Bluetooth
+hcsecd_enable="YES"
+sdpd_enable="YES"
+bthidd_enable="YES"
+
+spotifyd_enable="YES"
+
diff --git a/configs/desktop/home/.xinitrc b/configs/desktop/home/.xinitrc
new file mode 100644
index 0000000..0da3109
--- /dev/null
+++ b/configs/desktop/home/.xinitrc
@@ -0,0 +1,2 @@
+exec /usr/local/bin/i3
+
diff --git a/configs/shared/.gdbinit b/configs/shared/.gdbinit
new file mode 100644
index 0000000..9422460
--- /dev/null
+++ b/configs/shared/.gdbinit
@@ -0,0 +1 @@
+set disassembly-flavor intel
diff --git a/configs/shared/.gitconfig b/configs/shared/.gitconfig
new file mode 100644
index 0000000..e1344a8
--- /dev/null
+++ b/configs/shared/.gitconfig
@@ -0,0 +1,20 @@
+[user]
+ name = Eugene Triguba
+ email = eugenetriguba@gmail.com
+ signingkey = 36403459D7521702
+[core]
+ editor = vim
+ whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
+ excludesfile = ~/.gitignore
+[alias]
+ undo = reset HEAD~
+[pull]
+ ff = only
+[fetch]
+ prune = true
+[diff]
+ colorMoved = zebra
+[init]
+ defaultBranch = main
+[commit]
+ gpgsign = true
diff --git a/configs/shared/.tmux.conf b/configs/shared/.tmux.conf
new file mode 100644
index 0000000..207d7e8
--- /dev/null
+++ b/configs/shared/.tmux.conf
@@ -0,0 +1 @@
+set -g mouse on
diff --git a/configs/shared/.vimrc b/configs/shared/.vimrc
new file mode 100644
index 0000000..3e05ded
--- /dev/null
+++ b/configs/shared/.vimrc
@@ -0,0 +1,52 @@
+" Syntax highlighting
+colorscheme pablo
+syntax on
+
+" Flash screen instead of beep sound
+set visualbell
+
+" Change how vim represents characters on the screen
+set encoding=utf-8
+
+" Set the encoding of files written
+set fileencoding=utf-8
+
+" Set line numbers
+set number
+
+" don't break up words at end of window width
+set linebreak
+
+" Specify different areas of the screen where splits should occur
+set splitbelow
+set splitright
+
+" Python-specific whitespace file settings
+autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
+" ts - show existing tab with 4 spaces width
+" sw - when indenting with '>', use 4 spaces width
+" sts - control <tab> and <bs> keys to match tabstop
+
+" General whitespace settings
+set shiftwidth=4
+filetype plugin indent on
+
+" Allow backspace to delete indentation and inserted text
+" i.e. how it works in most programs
+set backspace=indent,eol,start
+" indent allow backspacing over autoindent
+" eol allow backspacing over line breaks (join lines)
+" start allow backspacing over the start of insert; CTRL-W and CTRL-U
+" stop once at the start of insert.
+
+call plug#begin("$HOME/.config/nvim/plugged")
+
+Plug 'Valloric/YouCompleteMe'
+Plug 'junegunn/fzf'
+
+Plug 'airblade/vim-gitgutter'
+Plug 'tpope/vim-fugitive'
+
+Plug 'editorconfig/editorconfig-vim'
+
+call plug#end()
diff --git a/configs/shared/.zshrc b/configs/shared/.zshrc
new file mode 100644
index 0000000..a6cb5e3
--- /dev/null
+++ b/configs/shared/.zshrc
@@ -0,0 +1,73 @@
+autoload -Uz vcs_info
+zstyle ":vcs_info:*" enable git svn
+zstyle ":vcs_info:git*" formats "- (%b) "
+precmd() {
+ vcs_info
+}
+setopt prompt_subst
+prompt="%2/ ${vcs_info_msg_0_}> "
+
+export EDITOR="nvim"
+export BROWSER="firefox"
+export PAGER="less"
+
+export SRC_DIR="$HOME/src"
+export BIN_DIR="$HOME/bin"
+
+export PATH="$HOME/.poetry/bin:$PATH"
+export PATH="$HOME/.pyenv/bin:$PATH"
+export PATH=$PATH:$GOPATH/bin
+export PATH=$PATH:$GOROOT/bin
+export PATH="$PATH:$HOME/.local/bin"
+export PATH="$BIN_DIR:$PATH"
+
+export GOPATH=$SRC_DIR/go
+export GOBIN=$SRC_DIR/go/bin
+
+alias gs="git status"
+alias gc="git commit"
+alias ga="git add"
+alias gd="git diff"
+alias gds="git diff --staged"
+alias gp="git push"
+alias gpo='git push origin'
+alias gplrb='git pull --rebase'
+alias gpl="git pull"
+alias gl='git log'
+alias gch="git checkout"
+alias gcb='git checkout -b'
+alias gv='git log --graph --decorate --oneline'
+
+alias h="history 25"
+alias j="jobs -l"
+alias l="ls -alG"
+alias o="xdg-open ."
+alias open="xdg-open"
+
+alias vi="nvim"
+alias vim="nvim"
+
+# "Compile C Program"
+#
+# $1: Program Name
+# $2: Output File (default: a.out)
+# $3: C Standard (default: c11)
+#
+# Example: ccp main.c main c99
+ccp() {
+ local prog_name=$1
+ local output_file=${2:a.out}
+ local std=${3:c11}
+
+ cc -Wall -W -pedantic -ansi -std=$std -o $output_file $prog_name
+}
+
+memcheck() {
+ G_DEBUG=always-malloc valgrind --tool=memcheck --leak-check=full --show-reachable=yes -s $1
+}
+
+gocover() {
+ t="/tmp/go-cover.$$.tmp"
+ go test -coverprofile=$t $@ && go tool cover -html=$t && unlink $t
+}
+
diff --git a/configs/shared/alacritty.yml b/configs/shared/alacritty.yml
new file mode 100644
index 0000000..bbec93c
--- /dev/null
+++ b/configs/shared/alacritty.yml
@@ -0,0 +1,11 @@
+font:
+ normal:
+ family: Hack
+ style: Regular
+
+window:
+ padding:
+ x: 8
+ y: 8
+ dynamic_padding: true
+
diff --git a/install b/install
new file mode 100755
index 0000000..3581ffa
--- /dev/null
+++ b/install
@@ -0,0 +1,41 @@
+#!/bin/sh
+#set -e
+
+repo_dir=$(realpath $(dirname "$0"))
+
+escalate() {
+ if [ -x "$(command -v sudo)" ]; then
+ sudo $@
+ elif [ -x "$(command -v doas)" ]; then
+ doas $@
+ else
+ echo "No sudo or doas found to escalate permissions"
+ exit 1
+ fi
+}
+
+if ! [ -x "$(command -v ansible-playbook)" ]; then
+ case "$(uname -s)" in
+ FreeBSD)
+ escalate pkg install --yes sysutils/ansible
+ ;;
+ Linux)
+ source /etc/os-release
+
+ if [ "$ID" != "fedora" ]; then
+ echo "[!] Unsupported Linux Distrobution"
+ exit 1
+ fi
+
+ escalate dnf install --assumeyes ansible
+ ;;
+ *)
+ echo "[!] Unsupported OS"
+ exit 1
+ ;;
+ esac
+fi
+
+export ANSIBLE_LOCALHOST_WARNING=false
+ansible-playbook --ask-become-pass "$repo_dir/ansible/setup.yaml"
+