Compare commits
24 commits
feat/bette
...
main
Author | SHA1 | Date | |
---|---|---|---|
7cfdeeda91 | |||
071996cf5b | |||
3a9e86e90e | |||
f0e509fbe2 | |||
e8a98665b6 | |||
0ed0d8542c | |||
0d61d6d3ad | |||
6b591be8de | |||
bd42ebc4bd | |||
2f427676c5 | |||
5c389255f3 | |||
da9f5c19f3 | |||
ec3765ce5c | |||
99a3500d9d | |||
178c51628b | |||
78ea75997a | |||
58358746d2 | |||
af064121c4 | |||
372fc636d7 | |||
67320b4e5d | |||
7a71ab38f4 | |||
bc0f75e65c | |||
7b6aa29a78 | |||
98890b34d2 |
23 changed files with 283 additions and 361 deletions
9
.forgejo/workflows/ci.yml
Normal file
9
.forgejo/workflows/ci.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sast:
|
||||||
|
runs-on: runner-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: pipx run pre-commit run -a
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.venv
|
6
.pre-commit-config.yaml
Normal file
6
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.6.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
1
.python-version
Normal file
1
.python-version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3.12
|
14
Dockerfile
Normal file
14
Dockerfile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
FROM debian:bookworm
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN apt update && apt upgrade -y --autoremove
|
||||||
|
|
||||||
|
RUN apt install -y\
|
||||||
|
pipx \
|
||||||
|
make \
|
||||||
|
sudo
|
||||||
|
|
||||||
|
ENV PATH="$PATH:/root/.local/bin"
|
||||||
|
|
||||||
|
CMD make configure-env PLAY=./home.yml
|
42
README.md
42
README.md
|
@ -1,43 +1,9 @@
|
||||||
# 🥫Environment-in-a-can
|
# 🥫Environment-in-a-can
|
||||||
|
|
||||||
Environment tweaks for everyday happiness.
|
Environment tweaks for (my) everyday happiness.
|
||||||
|
|
||||||
## Setup
|
Do the thing, it will do the needful: `make configure-env PLAY=<playbook-path>`.
|
||||||
|
|
||||||
```bash
|
## Development
|
||||||
git clone git@github.com:mcataford/env.git <path-of-your-choosing> | . ./bootstrap.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
The setup script will look for pre-existing managed blocks and will not update the file if one is found.
|
Repository prerequisites can be installed and validated via `make bootstrap` and containerized playbook tests can be run via `make test`.
|
||||||
|
|
||||||
### Updating existing setups
|
|
||||||
|
|
||||||
Since the managed blocks only `source` the files in this repository, pulling in updates from remote should bring in any
|
|
||||||
new tweaks you want to apply. If changes are made to the managed blocks, you will need to first remove them from where
|
|
||||||
they live and rerun the setup script.
|
|
||||||
|
|
||||||
## Structure
|
|
||||||
|
|
||||||
The package is structured as such:
|
|
||||||
|
|
||||||
```
|
|
||||||
env/
|
|
||||||
bootstrap.sh # Adds bootstrap block to your shell's config file.
|
|
||||||
files/
|
|
||||||
shell_extras # Functions, aliases and exports for the shell.
|
|
||||||
extras.vim # Common config for neovim.
|
|
||||||
git_config # Configuration commands for git
|
|
||||||
starship.toml # Starship prompt configuration
|
|
||||||
```
|
|
||||||
|
|
||||||
Adding code to `shell_extras` will add code that gets executed on shell-start.
|
|
||||||
|
|
||||||
### Adding steps
|
|
||||||
|
|
||||||
Each step is defined as a function in `steps.sh` and should start with a call to `pre_step` to ensure that a header gets
|
|
||||||
echo'ed out. Additionally, the function should be called from `bootstrap` in `bootstrap.sh` and the `TOTAL_STEPS` should
|
|
||||||
be updated to reflect the number of steps.
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
I'm not currently looking for contributions since this is mainly about standardizing my own setup across machines.
|
|
||||||
|
|
275
bootstrap.sh
275
bootstrap.sh
|
@ -1,275 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
#
|
|
||||||
# Marc's environment bootstrap script.
|
|
||||||
#
|
|
||||||
# Table of contents
|
|
||||||
#
|
|
||||||
# 1. Helpers and utilities
|
|
||||||
# These functions are used by individual bootstrap
|
|
||||||
# steps and are reused all over.
|
|
||||||
# 2. Steps
|
|
||||||
# Functions implementing a specific action in the
|
|
||||||
# bootstrap process.
|
|
||||||
# 3. Bootstrap sequence and callsite
|
|
||||||
# Where the magic happens.
|
|
||||||
# This is where the ordered sequence of steps
|
|
||||||
# is defined and run.
|
|
||||||
#
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
#
|
|
||||||
# 1. Helpers and utilities
|
|
||||||
#
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
STEP_COUNT=0
|
|
||||||
SUBSTEP_COUNT=0
|
|
||||||
|
|
||||||
# Pretty-print step headers.
|
|
||||||
pre_step() {
|
|
||||||
STEP_COUNT=$(($STEP_COUNT + 1))
|
|
||||||
SUBSTEP_COUNT=0
|
|
||||||
echo -e "\e[1m[$STEP_COUNT/$TOTAL_STEPS] <====== $1 =======>\e[0m"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Pretty-prints substep headers.
|
|
||||||
pre_substep() {
|
|
||||||
SUBSTEP_COUNT=$(($SUBSTEP_COUNT + 1))
|
|
||||||
echo -e "\e[1m[$STEP_COUNT.$SUBSTEP_COUNT] <====== $1 =======>\e[0m"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Copies a file from $1 to $2.
|
|
||||||
#
|
|
||||||
# If $2 exists, checks if $1 == $2 and asks what to do.
|
|
||||||
# From there, the user providing "O" will overwrite (proceed with copy),
|
|
||||||
# "S" will skip the file and leave the destination as-is, and anyting else
|
|
||||||
# will skip the copy altogether (i.e. "S").
|
|
||||||
copy_file() {
|
|
||||||
source_path=$1
|
|
||||||
dest_path=$2
|
|
||||||
|
|
||||||
if [ ! -e "$dest_path" ]; then
|
|
||||||
cp $source_path $dest_path
|
|
||||||
echo "Copied $source_path > $dest_path"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
difference="$(diff $source_path $dest_path)"
|
|
||||||
|
|
||||||
if [ -z "$difference" ]; then
|
|
||||||
echo "$dest_path already exists, but is the same as $source_path - skipping."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Differences detected between $source_path and $dest_path:"
|
|
||||||
diff --color $source_path $dest_path
|
|
||||||
read -p "$dest_path already exists. What should be done? [O:overwrite,S:skip,B:save backup and copy] " action
|
|
||||||
|
|
||||||
if [[ $action == "O" ]]; then
|
|
||||||
cp $source_path $dest_path
|
|
||||||
echo "Overwrote $source_path > $dest_path"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $action == "S" ]]; then
|
|
||||||
echo "Skipped and left $dest_path as is."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $action == "B" ]]; then
|
|
||||||
cp $dest_path $dest_path.old
|
|
||||||
echo "Backed up $dest_path up to $dest_path.old"
|
|
||||||
cp $source_path $dest_path
|
|
||||||
echo "Overwrote $source_path > $dest_path"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Unrecognized action, doing nothing."
|
|
||||||
}
|
|
||||||
|
|
||||||
##########################################################
|
|
||||||
#
|
|
||||||
# 2. Steps
|
|
||||||
#
|
|
||||||
##########################################################
|
|
||||||
|
|
||||||
# Ensures that all existing Apt packages are up-to-date.
|
|
||||||
ensure_apt_up_to_date() {
|
|
||||||
pre_step "Ensuring apt packages are up-to-date"
|
|
||||||
|
|
||||||
if [ -z "$(apt --version 2> /dev/null)" ]; then
|
|
||||||
echo -e "\e[33mApt not installed, skipping updates.\e[0m"
|
|
||||||
else
|
|
||||||
echo -e "\e[1mEnsuring system packages are up-to-date...\e[0m"
|
|
||||||
|
|
||||||
sudo apt update && sudo apt upgrade -y --autoremove
|
|
||||||
|
|
||||||
echo -e "\e[1;32mSystem packages up-to-date.\e[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Installs packages as specified in apt.txt
|
|
||||||
ensure_apt_dependencies() {
|
|
||||||
pre_step "Installing extra packages"
|
|
||||||
|
|
||||||
if [ -z "$(apt --version 2> /dev/null)" ]; then
|
|
||||||
echo -e "\e[33mApt not installed, skipping packages.\e[0m"
|
|
||||||
else
|
|
||||||
echo -e "\e[1mInstalling packages...\e[0m"
|
|
||||||
|
|
||||||
sudo apt install $(cat ./files/apt.txt) -y --autoremove
|
|
||||||
|
|
||||||
echo -e "\e[1;32mSystem packages installed.\e[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Installs the rustup toolchain if not installed.
|
|
||||||
# If installed, the toolchain is updated.
|
|
||||||
install_rust() {
|
|
||||||
pre_step "Install and configure Rust toolchain"
|
|
||||||
|
|
||||||
if [ -z "$(rustup --version 2> /dev/null)" ]; then
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
||||||
else
|
|
||||||
rustup update
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_omz() {
|
|
||||||
pre_step "Installs Oh My ZSH"
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | bash
|
|
||||||
}
|
|
||||||
|
|
||||||
# Installs the Starship prompt and adds an initialization
|
|
||||||
# command to the shell configuration file.
|
|
||||||
#
|
|
||||||
# Requires: install_rust
|
|
||||||
install_and_configure_starship() {
|
|
||||||
pre_step "Install and configure Starship"
|
|
||||||
|
|
||||||
pre_substep "Install Starship via cargo"
|
|
||||||
cargo install starship --locked
|
|
||||||
|
|
||||||
pre_substep "Add initialization command to shell configuration"
|
|
||||||
STARSHIP_INIT_COMMAND='eval "$(starship init zsh)"'
|
|
||||||
if [ -z "$(rg "starship init zsh" ~/.zshrc)" ]; then
|
|
||||||
echo "#Initialize Starship prompt\n$STARSHIP_INIT_COMMAND" >> ~/.zshrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
pre_substep "Copy configuration in configuration directory"
|
|
||||||
|
|
||||||
copy_file ./files/starship.toml ~/.config/starship.toml
|
|
||||||
}
|
|
||||||
|
|
||||||
install_nvm() {
|
|
||||||
pre_step "Installing nvm to manage node version"
|
|
||||||
|
|
||||||
pre_substep "Installing NVM from remote"
|
|
||||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
|
||||||
|
|
||||||
pre_substep "Ensuring that NVM can be run right away"
|
|
||||||
# Ensuring that nvm is usable right away without restarting the shell
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_gh_plugins() {
|
|
||||||
pre_step "Installing gh cli plugins"
|
|
||||||
|
|
||||||
gh extension install nektos/gh-act
|
|
||||||
|
|
||||||
gh extension install dlvhdr/gh-dash
|
|
||||||
copy_file ./files/gh-dash_config.yml ~/.config/gh-dash/config.yml
|
|
||||||
|
|
||||||
gh extension upgrade --all
|
|
||||||
}
|
|
||||||
|
|
||||||
install_pyenv() {
|
|
||||||
pre_step "Install and configure pyenv"
|
|
||||||
|
|
||||||
curl https://pyenv.run | bash
|
|
||||||
}
|
|
||||||
|
|
||||||
# Injects a managed block in the shell configuration.
|
|
||||||
inject_shell_configuration() {
|
|
||||||
pre_step "Injecting managed block in shell configuration"
|
|
||||||
|
|
||||||
BLOCK_DELIMITER_PATTERN="mcataford/env"
|
|
||||||
WORKING_PATH=$(git rev-parse --show-toplevel)
|
|
||||||
SHELL_CONFIG_PATH="$HOME/.zshrc"
|
|
||||||
|
|
||||||
echo "Setting up shell configuration extras..."
|
|
||||||
if [[ -z $(cat $SHELL_CONFIG_PATH | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
|
||||||
echo "# $BLOCK_DELIMITER_PATTERN\:start
|
|
||||||
source $WORKING_PATH/files/shell_extras
|
|
||||||
# $BLOCK_DELIMITER_PATTERN\:end" >> $SHELL_CONFIG_PATH
|
|
||||||
echo "✅ Added managed block to $SHELL_CONFIG_PATH"
|
|
||||||
else
|
|
||||||
echo "No changes to apply!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
EDITOR_CONFIG=$HOME/.config/nvim
|
|
||||||
EDITOR_CONFIG_FILE=$EDITOR_CONFIG/init.vim
|
|
||||||
}
|
|
||||||
|
|
||||||
# Injects a managed block in the vim configuration
|
|
||||||
inject_vim_configuration() {
|
|
||||||
pre_step "Inject managed block in vim configuration"
|
|
||||||
|
|
||||||
WORKING_PATH=$(git rev-parse --show-toplevel)
|
|
||||||
|
|
||||||
if [[ -f $EDITOR_CONFIG_FILE ]]; then
|
|
||||||
echo "Setting up NVIM configuration extras..."
|
|
||||||
if [[ -z $(cat $EDITOR_CONFIG_FILE | grep $BLOCK_DELIMITER_PATTERN) ]]; then
|
|
||||||
echo "\" $BLOCK_DELIMITER_PATTERN\:start
|
|
||||||
source $WORKING_PATH/files/extras.vim
|
|
||||||
\" $BLOCK_DELIMITER_PATTERN\:end\n\n" >> $EDITOR_CONFIG_FILE.new
|
|
||||||
cat $EDITOR_CONFIG_FILE >> $EDITOR_CONFIG_FILE.new
|
|
||||||
|
|
||||||
mv $EDITOR_CONFIG_FILE $EDITOR_CONFIG_FILE.old
|
|
||||||
mv $EDITOR_CONFIG_FILE.new $EDITOR_CONFIG_FILE
|
|
||||||
echo "✅ Added managed block to $EDITOR_CONFIG_FILE"
|
|
||||||
else
|
|
||||||
echo "No changes to apply!"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Setting up git configuration..."
|
|
||||||
source $WORKING_PATH/files/git_config
|
|
||||||
echo "✅ Set up git configuration, see $WORKING_PATH/files/git_config for details!"
|
|
||||||
}
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
#
|
|
||||||
# 3. Bootstrap sequence
|
|
||||||
#
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
TOTAL_STEPS=10
|
|
||||||
|
|
||||||
# Refer to steps.sh for step definition.
|
|
||||||
bootstrap() {
|
|
||||||
# System updates
|
|
||||||
ensure_apt_up_to_date
|
|
||||||
ensure_apt_dependencies
|
|
||||||
|
|
||||||
# Development tooling and SDKs
|
|
||||||
install_rust
|
|
||||||
install_pyenv
|
|
||||||
install_nvm
|
|
||||||
install_gh_plugins
|
|
||||||
|
|
||||||
# Shell & prompt setup
|
|
||||||
install_omz
|
|
||||||
install_and_configure_starship
|
|
||||||
|
|
||||||
inject_shell_configuration
|
|
||||||
inject_vim_configuration
|
|
||||||
}
|
|
||||||
|
|
||||||
bootstrap
|
|
||||||
return
|
|
|
@ -1,5 +0,0 @@
|
||||||
zsh
|
|
||||||
tmux
|
|
||||||
postgresql
|
|
||||||
postgresql-contrib
|
|
||||||
gh
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Always sign commits.
|
|
||||||
git config --global commit.gpgsign true
|
|
||||||
|
|
||||||
# Prune stale refs on fetch.
|
|
||||||
git config --global fetch.prune true
|
|
10
home.yml
Normal file
10
home.yml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
- name: Local environment
|
||||||
|
hosts: localhost
|
||||||
|
roles:
|
||||||
|
- system-packages
|
||||||
|
- dev-toolchain
|
||||||
|
- shell-tweaks
|
||||||
|
- editor-tweaks
|
||||||
|
- tool-config
|
||||||
|
- productivity-tools
|
27
makefile
Normal file
27
makefile
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
HELPTEXT="\
|
||||||
|
help: \n\
|
||||||
|
\tshows this helpful text.\n\
|
||||||
|
bootstrap: \n\
|
||||||
|
\tensures that repository-specific prerequisites are installed. \n\
|
||||||
|
test:\n\
|
||||||
|
\truns the playbook in a containerized environment for validation \n\
|
||||||
|
configure-env:\n\
|
||||||
|
\truns the playbook specified by PLAY on the host.\n\
|
||||||
|
"
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo $(HELPTEXT)
|
||||||
|
|
||||||
|
.PHONY: bootstrap
|
||||||
|
bootstrap:
|
||||||
|
pipx run pre-commit install
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
podman build . -t env-ansible-test
|
||||||
|
podman run env-ansible-test
|
||||||
|
|
||||||
|
.PHONY: configure-env
|
||||||
|
configure-env:
|
||||||
|
pipx install "ansible-core"
|
||||||
|
ansible-playbook -v --ask-become-pass $(PLAY)
|
19
roles/dev-toolchain/tasks/main.yml
Normal file
19
roles/dev-toolchain/tasks/main.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
- name: Check if rustup is installed
|
||||||
|
shell: which rustup
|
||||||
|
register: which_rustup
|
||||||
|
ignore_errors: true
|
||||||
|
- name: Install rustup
|
||||||
|
shell: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||||
|
when: which_rustup.rc == 1
|
||||||
|
- name: Check if go is installed
|
||||||
|
shell: go version
|
||||||
|
register: check_go_version
|
||||||
|
ignore_errors: true
|
||||||
|
- name: Install go
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
curl -o /tmp/go.tar.gz -L https://go.dev/dl/go{{go_version}}.linux-amd64.tar.gz &&
|
||||||
|
rm -rf /usr/local/go &&
|
||||||
|
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
|
||||||
|
when: check_go_version.rc == 1 or check_go_version.stdout.find(go_version) == -1
|
2
roles/dev-toolchain/vars/main.yml
Normal file
2
roles/dev-toolchain/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
go_version: 1.23.1
|
|
@ -22,7 +22,7 @@ set termguicolors
|
||||||
|
|
||||||
call plug#begin('~/.vim/plugged')
|
call plug#begin('~/.vim/plugged')
|
||||||
" Style
|
" Style
|
||||||
Plug 'joshdick/onedark.vim'
|
Plug 'bluz71/vim-nightfly-colors', { 'as': 'nightfly', 'branch': 'legacy' }
|
||||||
|
|
||||||
" Language support
|
" Language support
|
||||||
Plug 'maxmellon/vim-jsx-pretty'
|
Plug 'maxmellon/vim-jsx-pretty'
|
||||||
|
@ -44,7 +44,6 @@ Plug 'nvim-telescope/telescope-symbols.nvim'
|
||||||
Plug 'mcataford/ale'
|
Plug 'mcataford/ale'
|
||||||
|
|
||||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
""""""""""""""""
|
""""""""""""""""
|
||||||
|
@ -56,6 +55,6 @@ let mapleader=" "
|
||||||
nmap <leader>f <cmd>Telescope live_grep<CR>
|
nmap <leader>f <cmd>Telescope live_grep<CR>
|
||||||
nmap <leader>F <cmd>Telescope grep_string<CR>
|
nmap <leader>F <cmd>Telescope grep_string<CR>
|
||||||
|
|
||||||
colorscheme onedark
|
colorscheme nightfly
|
||||||
|
|
||||||
|
|
14
roles/editor-tweaks/tasks/main.yml
Normal file
14
roles/editor-tweaks/tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
- name: Ensure general config dir exists
|
||||||
|
file:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim"
|
||||||
|
state: directory
|
||||||
|
- name: Ensure .zshrc exists
|
||||||
|
file:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim"
|
||||||
|
state: touch
|
||||||
|
- name: Add nvim managed block
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/nvim/init.vim"
|
||||||
|
marker: "\" Marc's env managed block - {mark}"
|
||||||
|
block: "{{ lookup('ansible.builtin.file', 'files/extras.vim') }}"
|
9
roles/productivity-tools/tasks/main.yml
Normal file
9
roles/productivity-tools/tasks/main.yml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
- name: Thunderbird
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg: thunderbird
|
||||||
|
- name: TeXLive
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg: texlive
|
|
@ -1,3 +1,4 @@
|
||||||
|
---
|
||||||
prSections:
|
prSections:
|
||||||
- title: WIP
|
- title: WIP
|
||||||
filters: is:open author:@me -org:tophatmonocle
|
filters: is:open author:@me -org:tophatmonocle
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/bash
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# ALIASES #
|
# ALIASES #
|
||||||
################
|
################
|
||||||
|
@ -51,3 +49,23 @@ function which_alias {
|
||||||
# Ensures that passphrases can be entered when signing
|
# Ensures that passphrases can be entered when signing
|
||||||
# git commits.
|
# git commits.
|
||||||
export GPG_TTY=$(tty)
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
|
############
|
||||||
|
# CONFIG #
|
||||||
|
############
|
||||||
|
|
||||||
|
# Basic ZSH things.
|
||||||
|
export ZSH="/home/marc/.oh-my-zsh"
|
||||||
|
ZSH_THEME="lambda"
|
||||||
|
plugins=(git)
|
||||||
|
|
||||||
|
# OMZ configuration.
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
#Initialize Starship prompt
|
||||||
|
eval "$(starship init zsh)"
|
||||||
|
|
||||||
|
unsetopt autocd
|
||||||
|
|
||||||
|
# Local binaries.
|
||||||
|
export PATH=$PATH:$HOME/.local/bin
|
|
@ -1,45 +1,59 @@
|
||||||
format = """
|
format = """
|
||||||
[](#9A348E)\
|
[┌─](bold green) ☠️ \
|
||||||
$username\
|
[](color_orange)\
|
||||||
|
$username$hostname\
|
||||||
$os\
|
$os\
|
||||||
[](bg:#33658a fg:#9A348E)\
|
[](bg:color_blue fg:color_orange)\
|
||||||
$time\
|
$time\
|
||||||
[](bg:#DA627D fg:#33658a)\
|
[](bg:color_green fg:color_blue)\
|
||||||
$directory\
|
$directory\
|
||||||
[](fg:#DA627D bg:#3208e0)\
|
[](fg:color_green bg:color_pink)\
|
||||||
$git_branch\
|
$git_branch\
|
||||||
$git_status\
|
$git_status\
|
||||||
[](fg:#4208e0 bg:#9A348E)\
|
[](fg:color_pink bg:color_red)\
|
||||||
$python\
|
$python\
|
||||||
[](fg:#9A348E)
|
[](fg:color_red)
|
||||||
>
|
[└─ ](bold green)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Disable the blank line at the start of the prompt
|
# Disable the blank line at the start of the prompt
|
||||||
add_newline = true
|
add_newline = false
|
||||||
|
|
||||||
|
palette = 'default'
|
||||||
|
|
||||||
|
[palettes.default]
|
||||||
|
color_blue = '#458588'
|
||||||
|
color_green = '#98971a'
|
||||||
|
color_orange = '#d65d0e'
|
||||||
|
color_pink = '#b16286'
|
||||||
|
color_red = '#cc241d'
|
||||||
|
|
||||||
[python]
|
[python]
|
||||||
style = "bg:#9A348E"
|
style = "bg:color_red"
|
||||||
format = '[${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
format = '[${symbol}${pyenv_prefix}(${version} )(\($virtualenv\) )]($style)'
|
||||||
|
|
||||||
|
|
||||||
# You can also replace your username with a neat symbol like or disable this
|
# You can also replace your username with a neat symbol like or disable this
|
||||||
# and use the os module below
|
# and use the os module below
|
||||||
[username]
|
[username]
|
||||||
show_always = true
|
show_always = true
|
||||||
style_user = "bg:#9A348E"
|
style_user = "bg:color_orange"
|
||||||
style_root = "bg:#9A348E"
|
style_root = "bg:color_orange"
|
||||||
format = '[$user]($style)'
|
format = '[$user]($style)'
|
||||||
disabled = false
|
disabled = false
|
||||||
|
|
||||||
|
[hostname]
|
||||||
|
format = '[@$hostname ]($style)'
|
||||||
|
style = "bg:color_orange"
|
||||||
|
ssh_only = false
|
||||||
|
|
||||||
# An alternative to the username module which displays a symbol that
|
# An alternative to the username module which displays a symbol that
|
||||||
# represents the current operating system
|
# represents the current operating system
|
||||||
[os]
|
[os]
|
||||||
style = "bg:#9A348E"
|
style = "bg:color_red"
|
||||||
disabled = true # Disabled by default
|
disabled = true # Disabled by default
|
||||||
|
|
||||||
[directory]
|
[directory]
|
||||||
style = "bg:#DA627D"
|
style = "bg:color_green"
|
||||||
format = "[ $path ]($style)"
|
format = "[ $path ]($style)"
|
||||||
truncation_length = 3
|
truncation_length = 3
|
||||||
truncation_symbol = "…/"
|
truncation_symbol = "…/"
|
||||||
|
@ -59,15 +73,15 @@ truncation_symbol = "…/"
|
||||||
|
|
||||||
[git_branch]
|
[git_branch]
|
||||||
symbol = ""
|
symbol = ""
|
||||||
style = "bg:#4208e0"
|
style = "bg:color_pink"
|
||||||
format = '[ $symbol $branch ]($style)'
|
format = '[ $symbol $branch ]($style)'
|
||||||
|
|
||||||
[git_status]
|
[git_status]
|
||||||
style = "bg:#4208e0"
|
style = "bg:color_pink"
|
||||||
format = '[$all_status$ahead_behind ]($style)'
|
format = '[$all_status$ahead_behind ]($style)'
|
||||||
|
|
||||||
[time]
|
[time]
|
||||||
time_format = "%T"
|
time_format = "%T"
|
||||||
style = "bg:#33658A"
|
style = "bg:color_blue"
|
||||||
format = '[ $time ]($style)'
|
format = '[ $time ]($style)'
|
||||||
disabled = false
|
disabled = false
|
50
roles/shell-tweaks/tasks/main.yml
Normal file
50
roles/shell-tweaks/tasks/main.yml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
---
|
||||||
|
- name: Ensure general config dir exists
|
||||||
|
file:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config"
|
||||||
|
state: directory
|
||||||
|
- name: Install OMZsh
|
||||||
|
shell: |
|
||||||
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||||
|
args:
|
||||||
|
creates: "{{ lookup('ansible.builtin.env', 'HOME') }}/.oh-my-zsh"
|
||||||
|
- name: Ensure .zshrc exists
|
||||||
|
file:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
|
||||||
|
state: touch
|
||||||
|
- name: Add zsh managed block
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
|
||||||
|
marker: "# Marc's env managed block - {mark}"
|
||||||
|
block: "{{ lookup('ansible.builtin.file', 'files/shell_extras') }}"
|
||||||
|
- name: Install Starship
|
||||||
|
shell: $HOME/.cargo/bin/cargo install starship
|
||||||
|
- name: Ensure Starship config exists
|
||||||
|
file:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/starship.toml"
|
||||||
|
state: touch
|
||||||
|
- name: Add starship managed block
|
||||||
|
blockinfile:
|
||||||
|
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/starship.toml"
|
||||||
|
marker: "# Marc's env managed block - {mark}"
|
||||||
|
block: "{{ lookup('ansible.builtin.file', 'files/starship.toml') }}"
|
||||||
|
# TODO: Add gh cli login.
|
||||||
|
#- name: Check if gh-dash is installed
|
||||||
|
# shell: gh extension list
|
||||||
|
# register: gh_ext_list
|
||||||
|
#- name: Install gh CLI extensions (gh-dash)
|
||||||
|
# command: gh extension install dlvhdr/gh-dash
|
||||||
|
# when: gh_ext_list.stdout.find('gh dash') == -1
|
||||||
|
#- name: Ensure gh-dash config directory exists
|
||||||
|
# file:
|
||||||
|
# path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash"
|
||||||
|
# state: directory
|
||||||
|
#- name: Ensure gh-dash config exists
|
||||||
|
# file:
|
||||||
|
# path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml"
|
||||||
|
# state: touch
|
||||||
|
#- name: Add gh-dash configuration managed block
|
||||||
|
# blockinfile:
|
||||||
|
# path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.config/gh-dash/config.yml"
|
||||||
|
# marker: "# Marc's env managed block - {mark}"
|
||||||
|
# block: "{{ lookup('ansible.builtin.file', 'files/gh-dash.yml') }}"
|
42
roles/system-packages/tasks/main.yml
Normal file
42
roles/system-packages/tasks/main.yml
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
- name: Ensure system up-to-date
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
update_cache: true
|
||||||
|
upgrade: "yes"
|
||||||
|
- name: Install Build Essentials
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- make
|
||||||
|
- build-essential
|
||||||
|
- cmake
|
||||||
|
- name: Install terminal & shell
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- zsh
|
||||||
|
- tmux
|
||||||
|
- name: Install CLI tooling
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- shellcheck
|
||||||
|
- gh
|
||||||
|
- curl
|
||||||
|
- git
|
||||||
|
- name: Install DB-related tooling
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
- name: Install Podman
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
pkg:
|
||||||
|
- podman
|
||||||
|
- name: Install Ripgrep
|
||||||
|
become: true
|
||||||
|
apt:
|
||||||
|
deb: https://github.com/BurntSushi/ripgrep/releases/download/{{ripgrep_version}}/ripgrep_{{ripgrep_version}}-1_amd64.deb
|
2
roles/system-packages/vars/main.yml
Normal file
2
roles/system-packages/vars/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
ripgrep_version: 14.1.1
|
5
roles/tool-config/tasks/main.yml
Normal file
5
roles/tool-config/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- name: Configure git
|
||||||
|
shell: |
|
||||||
|
git config --global commit.gpgsign true
|
||||||
|
git config --global fetch.prune true
|
Loading…
Reference in a new issue