Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ mock_modules:
- snap
- community.general.npm
- community.general.pacman
- community.general.flatpak
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ repos:
rev: v0.11.0
hooks:
- id: shellcheck
exclude: ^roles/(penrose|sway)/
exclude: ^roles/penrose/
stages: [pre-commit, pre-push]

# Shell format (mvdan/sh Docker image).
Expand All @@ -53,12 +53,12 @@ repos:
- id: shfmt-docker
name: shfmt (check shell)
args: [-d, -i, "2", -ci]
exclude: ^roles/(penrose|sway)/
exclude: ^roles/penrose/
stages: [pre-commit, pre-push]
- id: shfmt-docker
name: shfmt (format shell)
args: [-w, -i, "2", -ci]
exclude: ^roles/(penrose|sway)/
exclude: ^roles/penrose/
stages: [manual]

- repo: local
Expand Down
92 changes: 74 additions & 18 deletions bin/dot-bootstrap
Original file line number Diff line number Diff line change
@@ -1,21 +1,77 @@
#!/usr/bin/env bash
set -e

if ! [ -x "$(command -v ansible)" ]; then
sudo apt install ansible
fi

# ansible-galaxy install gantsign.antigen --ignore-certs
if ! [ -x "$(ansible-galaxy collection list community.general)" ]; then
ansible-galaxy collection install community.general --ignore-certs
fi
# if ! [ -x "$(ansible-galaxy list viasite-ansible.zsh)" ]; then
# ansible-galaxy install viasite-ansible.zsh --force --ignore-certs
# fi

echo "Setting up local dev environment"
ansible-playbook -i ~/git/dot-files/hosts ~/git/dot-files/dotfiles.yml --ask-become-pass -v "$@"

if command -v terminal-notifier 1>/dev/null 2>&1; then
terminal-notifier -title "dotfiles: Bootstrap complete" -message "Successfully set up dev environment."
fi
detect_os() {
if [ -f /etc/os-release ]; then
# shellcheck source=/dev/null
. /etc/os-release
echo "$ID"
else
uname -s | tr '[:upper:]' '[:lower:]'
fi
}

install_prereqs() {
local os="$1"
local pkgs=(ansible just git curl)

# Check if all packages are already installed
local install_needed=false
for pkg in "${pkgs[@]}"; do
if ! command -v "$pkg" &>/dev/null; then
install_needed=true
break
fi
done

if [ "$install_needed" = false ]; then
return 0
fi

case "$os" in
ubuntu | debian | pop | mint)
echo "Installing Debian/Ubuntu prerequisites..."
sudo apt-get update
sudo apt-get install -y ansible just git curl
;;
arch | manjaro)
echo "Installing Arch Linux prerequisites..."
sudo pacman -Sy --needed --noconfirm ansible just git curl
;;
*)
echo "Unsupported OS: $os"
echo "Please ensure ansible, just, git, and curl are installed manually."
exit 1
;;
esac
}

install_collections() {
if ! ansible-galaxy collection list community.general >/dev/null 2>&1; then
echo "Installing community.general collection..."
ansible-galaxy collection install community.general --ignore-certs
fi
}

run_playbook() {
if [[ "$1" == "--check" ]] || [[ "$1" == "dry-run" ]]; then
echo "Running dry-run..."
shift
just dry-run "$@"
else
echo "Applying dotfiles configuration..."
just apply "$@"
fi
}

main() {
local os
os=$(detect_os)
echo "Detected OS: $os"

install_prereqs "$os"
install_collections
run_playbook "$@"
}

main "$@"
47 changes: 16 additions & 31 deletions dotfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@
- "git"
- "fzf"
- "zsh"
- "tmux"
# - "emacs"
# - "doom-emacs"
- "zellij"
- "nvim"
- "rust"
# - "sway"
# - "wm"
- "packages"
- "xinput"

Expand All @@ -29,49 +25,38 @@
tags:
- "git"
# - {role: fish, tags: ['fish']}
- role: programming
tags:
- "rustup"
- "cargo"
- "rust"
- "go"
- "programming"
- role: jj
tags:
- "jj"
- role: fzf
tags:
- "fzf"
- role: zsh
tags:
- "zsh"
- role: tmux
- role: zellij
tags:
- "tmux"
- "zellij"
- role: nvim
tags:
- "nvim"
# - role: haskell
# tags:
# - "stack"
- role: programming
- role: penrose
tags:
- "rustup"
- "cargo"
- "rust"
- "go"
- "programming"
# - role: sway
# tags:
# - "sway"
# - "wm"
# - role: penrose
# tags:
# - "wm"
# - "penrose"
# - "bspwm"
# - role: xmonad
# tags:
# - "xmonad"
- "wm"
- "penrose"
- role: firefox
tags:
- firefox
- role: packages
tags:
- "packages"
- role: jj
tags:
- "jj"
- role: xinput
tags:
- "xinput"
1 change: 1 addition & 0 deletions group_vars/local
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
dotfiles_user: "{{ lookup('env', 'USER') }}"
dotfiles_user_home: "{{ '~' | expanduser }}"
dotfiles_home: "{{dotfiles_user_home}}/git/dot-files"
xdg_config_home: "{{ lookup('env', 'XDG_CONFIG_HOME') | default(dotfiles_user_home ~ '/.config', true) }}"

full_name: Kevin Oberlies

Expand Down
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ lint-yaml DIR=".":
# Lint the Ansible playbook and roles with ansible-lint (config: .ansible-lint).
lint-ansible:
uvx ansible-lint

# Run a dry run of the Ansible playbook to see what changes would be made
dry-run *ARGS:
ansible-playbook -i hosts dotfiles.yml -v --check --diff {{ ARGS }}

# Apply the dotfiles configuration to the local system
apply *ARGS:
ansible-playbook -i hosts dotfiles.yml --ask-become-pass -v {{ ARGS }}
13 changes: 13 additions & 0 deletions mermaid-sample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Mermaid sample

Open this file in nvim (running directly in kitty) to verify the
`diagram.nvim` + `image.nvim` setup renders mermaid blocks inline.

```mermaid
flowchart TD
A[Start] --> B{mmdc installed?}
B -- yes --> C[Render diagram inline]
B -- no --> D[Run packages role]
D --> B
C --> E[Done]
```
14 changes: 14 additions & 0 deletions roles/fzf/tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
- name: Check if fzf is installed
command: dpkg-query -W -f='${Status}' fzf
register: fzf_check
ignore_errors: true
changed_when: false
become: false
check_mode: no

- name: Report fzf installation status (Check Mode Only)
debug:
msg: "fzf is missing and would be installed"
when: ansible_check_mode and fzf_check.rc is defined and fzf_check.rc != 0

- name: Install fzf from apt
apt:
name: fzf
state: present
become: true
become_method: sudo
when: not ansible_check_mode and fzf_check.rc is defined and fzf_check.rc != 0
14 changes: 14 additions & 0 deletions roles/git/tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
- name: Check if git is installed
command: dpkg-query -W -f='${Status}' git
register: git_check
ignore_errors: true
changed_when: false
become: false
check_mode: no

- name: Report git installation status (Check Mode Only)
debug:
msg: "git is missing and would be installed"
when: ansible_check_mode and git_check.rc is defined and git_check.rc != 0

- name: Install git with apt
apt:
name: git
state: present
become_method: sudo
become: true
when: not ansible_check_mode and git_check.rc is defined and git_check.rc != 0
14 changes: 14 additions & 0 deletions roles/haskell/tasks/debian.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
- name: Check if haskell-stack is installed
command: dpkg-query -W -f='${Status}' haskell-stack
register: haskell_check
ignore_errors: true
changed_when: false
become: false
check_mode: no

- name: Report haskell-stack status (Check Mode Only)
debug:
msg: "haskell-stack is missing and would be installed"
when: ansible_check_mode and haskell_check.rc is defined and haskell_check.rc != 0

- name: Install haskell-stack
apt:
name:
Expand All @@ -6,3 +19,4 @@
force_apt_get: yes
become: true
become_method: sudo
when: not ansible_check_mode and haskell_check.rc is defined and haskell_check.rc != 0
11 changes: 6 additions & 5 deletions roles/jj/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
- name: Install jj with cargo binstall
command: cargo binstall -y --strategies crate-meta-data jj-cli
- name: Install jj with cargo-binstall
command: "{{ dotfiles_user_home }}/.cargo/bin/cargo-binstall -y --strategies crate-meta-data jj-cli"
args:
creates: "{{ ansible_env.HOME }}/.cargo/bin/jj"
creates: "{{ dotfiles_user_home }}/.cargo/bin/jj"
when: not ansible_check_mode

- name: Create jj config directory
file:
state: directory
dest: "{{ dotfiles_user_home }}/.config/jj"
dest: "{{ xdg_config_home }}/jj"

- name: Hard link jj config.toml
file:
src: "{{ dotfiles_home }}/roles/jj/files/config.toml"
dest: "{{ dotfiles_user_home }}/.config/jj/config.toml"
dest: "{{ xdg_config_home }}/jj/config.toml"
state: hard
force: true
8 changes: 5 additions & 3 deletions roles/nvim/files/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"black-nvim": { "branch": "master", "commit": "8fb3efc562b67269e6f31f8653297f826534fa4b" },
"blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" },
"blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" },
"blink.lib": { "branch": "main", "commit": "b127d48bf8e9ac9cf41f6e0fbead317503f76558" },
"blink.lib": { "branch": "main", "commit": "e8cd0d6b0ffac8e1cd33ce66df70a8b24808b4cd" },
"cmp-digraphs": { "branch": "master", "commit": "5efc1f0078d7c5f3ea1c8e3aad04da3fd6e081a9" },
"codecompanion-history.nvim": { "branch": "main", "commit": "bc1b4fe06eaaf0aa2399be742e843c22f7f1652a" },
"codecompanion.nvim": { "branch": "main", "commit": "7cc35b7f7f08d093469fa9ae67d3af716bd729c3" },
"copilot.lua": { "branch": "master", "commit": "b54c05349d406f7af11b150824efa8e4f90015c6" },
"copilot.lua": { "branch": "master", "commit": "7df55b20b5b653941f0bcff87e559cabb6fafeb0" },
"crates.nvim": { "branch": "main", "commit": "694357861ec9ebf12475ddcdd04ea45a0923c32d" },
"diagram.nvim": { "branch": "master", "commit": "a221810b17cdda2d5fdddba9bab3eba6fab8fabc" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"fern.vim": { "branch": "main", "commit": "3d580357c09e199b0fa7d560b2db1ad05de02b9c" },
"ferris.nvim": { "branch": "main", "commit": "275865530d753a205740804f1ce163af2322db57" },
Expand All @@ -23,6 +24,7 @@
"gitsigns.nvim": { "branch": "main", "commit": "25050e4ed39e628282831d4cbecb1850454ce915" },
"hunk.nvim": { "branch": "master", "commit": "c8a8e7b6973576f63e5bf39aa8338d7f37f4dc53" },
"hydra.nvim": { "branch": "main", "commit": "8c4a9f621ec7cdc30411a1f3b6d5eebb12b469dc" },
"image.nvim": { "branch": "master", "commit": "88351f1f7d9dbae286e671ce3690a49660dd8a5c" },
"iron.nvim": { "branch": "master", "commit": "88cd340407b959f1168af2a6ae5a3d180e6df32c" },
"jj-diffconflicts": { "branch": "main", "commit": "a2aa9a247b56d2c1a6f6be81bcf41c5450cc82ff" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
Expand Down Expand Up @@ -61,7 +63,7 @@
"pomo.nvim": { "branch": "main", "commit": "7e06e5221d8d1e596a0ab29dd4d7fcee5f3cd05a" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"schemastore.nvim": { "branch": "main", "commit": "304d2286752923e3b0eb1ddcb3d4002a69b855ad" },
"schemastore.nvim": { "branch": "main", "commit": "735540a7602bffd1b07deab7d508affb57b78c64" },
"suda.vim": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
"tcomment_vim": { "branch": "master", "commit": "48ab639a461d9b8344f7fee06cb69b4374863b13" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" },
Expand Down
Loading
Loading