Compare commits
2 Commits
a17e29ff72
...
7770c4b5e4
| Author | SHA1 | Date | |
|---|---|---|---|
| 7770c4b5e4 | |||
| c61066eb44 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -0,0 +1 @@
|
|||||||
|
.idea/
|
||||||
|
|||||||
12
README.md
12
README.md
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Run the `install.sh` script to install neovim, zsh (via oh-my-zsh) and all of the omz plugins.
|
```bash
|
||||||
|
pacman -S ansible-tools
|
||||||
|
ansible-galaxy install -r requirements.yml
|
||||||
|
ansible-playbook playbook.yml --ask-become-pass
|
||||||
|
```
|
||||||
|
|
||||||
## nvim
|
- Install nerdfont -- TODO
|
||||||
|
|
||||||
-- TODO --
|
|
||||||
|
|
||||||
- Install nerdfont
|
|
||||||
|
|
||||||
## zsh
|
## zsh
|
||||||
|
|
||||||
|
|||||||
4
ansible.cfg
Normal file
4
ansible.cfg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[default]
|
||||||
|
inventory = inventory
|
||||||
|
stdout_callback = yaml
|
||||||
|
host_key_checking = False
|
||||||
102
group_vars/all.yml
Normal file
102
group_vars/all.yml
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
default_roles:
|
||||||
|
# === Core System Tools (Recommended) ===
|
||||||
|
- system # Essential system configurations and tools
|
||||||
|
- fonts # Developer-friendly fonts (Nerd Fonts)
|
||||||
|
|
||||||
|
# === Development Core ===
|
||||||
|
- git # Version control system
|
||||||
|
- neovim # Modern text editor (or use 'vim')
|
||||||
|
- tmux # Terminal multiplexer for session management
|
||||||
|
|
||||||
|
# === Shell Environment ===
|
||||||
|
- zsh # Modern shell with oh-my-zsh
|
||||||
|
|
||||||
|
# === Development Languages ===
|
||||||
|
- nvm # Node Version Manager
|
||||||
|
- npm # Node Package Manager
|
||||||
|
- go # Go programming language
|
||||||
|
# - rust # Rust programming language
|
||||||
|
# - ruby # Ruby programming language
|
||||||
|
# - lua # Lua programming language
|
||||||
|
# === DevOps & Cloud Tools ===
|
||||||
|
- docker # Container platform
|
||||||
|
|
||||||
|
# === System Monitoring ===
|
||||||
|
- btop # Modern system monitor (better than htop)
|
||||||
|
# - neofetch # System information display
|
||||||
|
# - nerdfetch # Alternative system info with ASCII art
|
||||||
|
# - ncdu # Disk usage analyzer
|
||||||
|
|
||||||
|
# === Terminal Emulators ===
|
||||||
|
# - kitty # GPU-accelerated terminal
|
||||||
|
# - warp # Modern terminal with AI features
|
||||||
|
|
||||||
|
# === Productivity Tools ===
|
||||||
|
# - obsidian # Knowledge management and note-taking
|
||||||
|
# - raycast # macOS launcher and productivity tool
|
||||||
|
# - hammerspoon # macOS automation and window management
|
||||||
|
# - taskfile # Modern task runner (alternative to make)
|
||||||
|
# - tldr # Simplified command documentation
|
||||||
|
# - slides # Terminal-based presentation tool
|
||||||
|
|
||||||
|
# === Communication & Media ===
|
||||||
|
# - discord # Team communication
|
||||||
|
# - spotify # Music streaming
|
||||||
|
|
||||||
|
# === Network & Remote Access ===
|
||||||
|
# - ssh # SSH client configuration
|
||||||
|
# - sshfs # Mount remote filesystems via SSH
|
||||||
|
# - tmate # Terminal sharing for pair programming
|
||||||
|
|
||||||
|
# === macOS Specific ===
|
||||||
|
# - aldente # Battery charge limiter for macOS
|
||||||
|
|
||||||
|
# === Linux Specific ===
|
||||||
|
# - flatpak # Universal Linux package manager
|
||||||
|
# - nala # Better apt frontend for Ubuntu/Debian
|
||||||
|
|
||||||
|
# === Browser Tools ===
|
||||||
|
# - brave # Privacy-focused web browser
|
||||||
|
|
||||||
|
# === Cloud & Infrastructure CLIs ===
|
||||||
|
# - aws # Amazon Web Services CLI
|
||||||
|
# - azure # Microsoft Azure CLI
|
||||||
|
# - nomad # HashiCorp Nomad (alternative to Kubernetes)
|
||||||
|
|
||||||
|
# === Container Alternatives ===
|
||||||
|
# - orbstack # Docker Desktop alternative for macOS
|
||||||
|
|
||||||
|
# === Additional Terminal Emulators ===
|
||||||
|
# - alacritty # Cross-platform GPU-accelerated terminal
|
||||||
|
# - ghostty # Fast, feature-rich terminal emulator
|
||||||
|
|
||||||
|
# === Development Tools ===
|
||||||
|
# - just # Command runner (modern alternative to make)
|
||||||
|
# - goreleaser # Go application release automation
|
||||||
|
|
||||||
|
# === Kubernetes Ecosystem ===
|
||||||
|
# - kind # Kubernetes in Docker for local testing
|
||||||
|
# - kwctl # Kubernetes policy engine management
|
||||||
|
|
||||||
|
# === Network & VPN Tools ===
|
||||||
|
# - wireguard # Modern VPN solution
|
||||||
|
|
||||||
|
# === Alternative Shells ===
|
||||||
|
# - bash # Traditional bash shell configuration
|
||||||
|
# - pwsh # PowerShell for cross-platform scripting
|
||||||
|
# - zellij # Terminal workspace manager (alternative to tmux)
|
||||||
|
|
||||||
|
# === Package Managers ===
|
||||||
|
# - whalebrew # Homebrew but with Docker images
|
||||||
|
|
||||||
|
# === Windows Specific ===
|
||||||
|
# - winget # Windows package manager (Windows only)
|
||||||
|
|
||||||
|
# === Fun Stuff ===
|
||||||
|
# - asciiquarium # Animated ASCII aquarium for your terminal
|
||||||
|
|
||||||
|
# === Security & Authentication ===
|
||||||
|
# - 1password # 1Password CLI integration
|
||||||
|
|
||||||
|
# === Network Analysis ===
|
||||||
|
# - tshark # Command-line network protocol analyzer
|
||||||
64
install.sh
64
install.sh
@ -1,48 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
command_exists() {
|
set -e
|
||||||
command -v "$1" >/dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
create_symlink() {
|
DOTFILES_DIR="$HOME/dotfiles"
|
||||||
local source=$1
|
|
||||||
local target=$2
|
|
||||||
|
|
||||||
if [ ! -e "$target" ]; then
|
|
||||||
ln -s "$source" "$target"
|
function arch_setup() {
|
||||||
echo "Added symlink $source -> $target"
|
if ! [ -x "$(which ansible)" ]; then
|
||||||
|
echo "Installing ansible"
|
||||||
|
sudo pacman -S ansible
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
install_package() {
|
|
||||||
local package=$1
|
function detect_os() {
|
||||||
if ! command_exists "$package"; then
|
source /etc/os-release
|
||||||
# sudo dnf update && sudo dnf install "$package"
|
echo "$ID"
|
||||||
sudo pacman -S "$package"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_package "neovim"
|
local_os=$(detect_os)
|
||||||
create_symlink "$HOME/dotfiles/nvim" "$HOME/.config/nvim"
|
|
||||||
|
|
||||||
install_package "zsh"
|
case $local_os in
|
||||||
create_symlink "$HOME/dotfiles/zsh/.zshrc" "$HOME/.zshrc"
|
cachyos|arch)
|
||||||
|
arch_setup
|
||||||
|
;;
|
||||||
|
debian)
|
||||||
|
debian_setup
|
||||||
|
;;
|
||||||
|
fedora)
|
||||||
|
fedora_setup
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "OS $local_os not supported"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
ansible-playbook "$DOTFILES_DIR/playbook.yml" "$@"
|
||||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ZSH_CUSTOM=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}
|
|
||||||
|
|
||||||
# Install zsh-syntax-highlighting
|
|
||||||
if [ ! -d "${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting" ]; then
|
|
||||||
git clone --depth 1 https://github.com/zsh-users/zsh-syntax-highlighting.git \
|
|
||||||
${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Install zsh-syntax-highlighting
|
|
||||||
if [ ! -d "${ZSH_CUSTOM}/plugins/fzf-zsh-plugin" ]; then
|
|
||||||
git clone --depth 1 https://github.com/unixorn/fzf-zsh-plugin.git \
|
|
||||||
${ZSH_CUSTOM}/plugins/fzf-zsh-plugin
|
|
||||||
fi
|
|
||||||
@ -1,41 +1,41 @@
|
|||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||||
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
|
"alpha-nvim": { "branch": "main", "commit": "2b3cbcdd980cae1e022409289245053f62fb50f6" },
|
||||||
"auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" },
|
"auto-session": { "branch": "main", "commit": "ee320d7a59c1dfe83df7c9d58150d9f194690d53" },
|
||||||
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
|
"bufdelete.nvim": { "branch": "master", "commit": "f6bcea78afb3060b198125256f897040538bcb81" },
|
||||||
"bufferline.nvim": { "branch": "main", "commit": "5726c4e291224181903e960119a11e20ac677a0a" },
|
"bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "e52e640b7befd8113b3350f46e8cfcfe98fcf730" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||||
"flutter-tools.nvim": { "branch": "main", "commit": "234a9d4022d0a17301e85a08660d489bffb7383f" },
|
"flutter-tools.nvim": { "branch": "main", "commit": "65b7399804315a1160933b64292d3c5330aa4e9f" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||||
"lazygit.nvim": { "branch": "main", "commit": "77a0d42943d8265271e6e6beaed72da54eeb17e7" },
|
"lazygit.nvim": { "branch": "main", "commit": "cdd3527e251f96eb0527162b156ad839286fcd97" },
|
||||||
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
|
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
"mason.nvim": { "branch": "main", "commit": "4da89f3ab04783da990f9bd40aaa36c22e59375b" },
|
||||||
"monokai-nightasty.nvim": { "branch": "main", "commit": "78137f1ab7b42fc41a1ace10674889bc0aa9a28a" },
|
"monokai-nightasty.nvim": { "branch": "main", "commit": "8182c45dcaf82e7316cfda6d439ee8ad783ae594" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
"none-ls-extras.nvim": { "branch": "main", "commit": "6557f20e631d2e9b2a9fd27a5c045d701a3a292c" },
|
"none-ls-extras.nvim": { "branch": "main", "commit": "924fe88a9983c7d90dbb31fc4e3129a583ea0a90" },
|
||||||
"none-ls.nvim": { "branch": "main", "commit": "cc810f70852bd37334fad658372a8cfedd1da4e8" },
|
"none-ls.nvim": { "branch": "main", "commit": "3ce66bc62eb363f19cceeb1fae2e71ea2bede56d" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "b464658e9b880f463b9f7e6ccddd93fb0013f559" },
|
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" },
|
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
|
||||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
"nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "8121483b8132b7053120fafd83728178fb3febf6" },
|
"nvim-lspconfig": { "branch": "master", "commit": "4d3b3bb8815fbe37bcaf3dbdb12a22382bc11ebe" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
|
"nvim-surround": { "branch": "main", "commit": "7a7a78a52219a3312c1fcabf880cea07a7956a5f" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "68fc4c20f5803444277022c681785c5edd11916d" },
|
"nvim-tree.lua": { "branch": "master", "commit": "a9156c013916d3c8a2905ab2e26e9dd74beb642e" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "622a4a6ba76d1de52b72a965159213ae655b4ac7" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" },
|
"nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "dae2eac9d91464448b584c7949a31df8faefec56" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
"todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" },
|
||||||
"venv-selector.nvim": { "branch": "regexp", "commit": "e82594274bf7b54387f9a2abe65f74909ac66e97" },
|
"venv-selector.nvim": { "branch": "regexp", "commit": "c677caa1030808a9f90092e522de7cc20c1390dd" },
|
||||||
"vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" },
|
"vim-floaterm": { "branch": "master", "commit": "fd4bdd66eca56c6cc59f2119e4447496d8cde2ea" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "1f8d414f61e0b05958c342df9b6a4c89ce268766" }
|
"which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
'williamboman/mason.nvim',
|
{ 'williamboman/mason.nvim', commit = '4da89f3' },
|
||||||
dependencies = {
|
{ 'williamboman/mason-lspconfig.nvim', commit = '1a31f82' },
|
||||||
'williamboman/mason-lspconfig.nvim',
|
{ 'WhoIsSethDaniel/mason-tool-installer.nvim' },
|
||||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
local mason = require('mason')
|
local mason = require('mason')
|
||||||
local mason_lspconfig = require('mason-lspconfig')
|
local mason_lspconfig = require('mason-lspconfig')
|
||||||
|
|||||||
127
playbook.yml
Normal file
127
playbook.yml
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
---
|
||||||
|
- name: Setup dotfiles configuration
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
become: false
|
||||||
|
vars:
|
||||||
|
dotfiles_dir: "{{ ansible_env.HOME }}/dotfiles"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Install packages with pacman
|
||||||
|
become: true
|
||||||
|
pacman:
|
||||||
|
name:
|
||||||
|
- neovim
|
||||||
|
- zsh
|
||||||
|
- git
|
||||||
|
- openssh
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install oh-my-zsh from AUR
|
||||||
|
kewlfft.aur.aur:
|
||||||
|
name: oh-my-zsh-git
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Create necessary directories
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
loop:
|
||||||
|
- "{{ ansible_env.HOME }}/.config"
|
||||||
|
- "{{ ansible_env.HOME }}/.ssh"
|
||||||
|
|
||||||
|
- name: Check if neovim config exists
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/nvim"
|
||||||
|
register: nvim_config
|
||||||
|
|
||||||
|
- name: Symlink neovim config
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/nvim"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.config/nvim"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
when: nvim_config.stat.exists
|
||||||
|
|
||||||
|
- name: Check if zsh config exists
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||||
|
register: zsh_config
|
||||||
|
|
||||||
|
- name: Symlink zsh config
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.zshrc"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
when: zsh_config.stat.exists
|
||||||
|
|
||||||
|
- name: Change default shell to zsh
|
||||||
|
become: true
|
||||||
|
user:
|
||||||
|
name: "{{ ansible_env.USER }}"
|
||||||
|
shell: /usr/bin/zsh
|
||||||
|
|
||||||
|
- name: Symlink SSH askpass config
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/ssh_askpass.conf"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.ssh/askpass.conf"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
when: zsh_config.stat.exists
|
||||||
|
|
||||||
|
- name: Check if git config exists
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||||
|
register: git_config
|
||||||
|
|
||||||
|
- name: Symlink global git config
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.gitconfig"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
when: git_config.stat.exists
|
||||||
|
|
||||||
|
- name: Check if kde config exists
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/kde"
|
||||||
|
register: kde_config
|
||||||
|
|
||||||
|
- name: Find KDE config files in dotfiles
|
||||||
|
find:
|
||||||
|
paths: "{{ dotfiles_dir }}/kde"
|
||||||
|
patterns: "*"
|
||||||
|
file_type: file
|
||||||
|
register: kde_configs
|
||||||
|
when: kde_config.stat.exists
|
||||||
|
|
||||||
|
- name: Symlink KDE config files
|
||||||
|
file:
|
||||||
|
src: "{{ item.path }}"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.config/{{ item.path | basename }}"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
loop: "{{ kde_configs.files }}"
|
||||||
|
when: kde_configs.files is defined
|
||||||
|
|
||||||
|
- name: Install yay if not present (for AUR packages)
|
||||||
|
block:
|
||||||
|
- name: Check if yay is installed
|
||||||
|
command: which yay
|
||||||
|
register: yay_check
|
||||||
|
failed_when: false
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Install yay from AUR
|
||||||
|
become: true
|
||||||
|
shell: |
|
||||||
|
cd /tmp
|
||||||
|
git clone https://aur.archlinux.org/yay.git
|
||||||
|
cd yay
|
||||||
|
makepkg -si --noconfirm
|
||||||
|
cd ..
|
||||||
|
rm -rf yay
|
||||||
|
when: yay_check.rc != 0
|
||||||
|
|
||||||
4
requirements.yml
Normal file
4
requirements.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
collections:
|
||||||
|
- community.general
|
||||||
|
- kewlfft.aur
|
||||||
238
todo_ansible.md
Normal file
238
todo_ansible.md
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
Here's how such a role-based Ansible dotfiles configuration would work:
|
||||||
|
|
||||||
|
## Directory Structure
|
||||||
|
```
|
||||||
|
dotfiles/
|
||||||
|
├── playbook.yml # Main playbook
|
||||||
|
├── group_vars/
|
||||||
|
│ └── all.yml # Your config with default_roles
|
||||||
|
├── roles/
|
||||||
|
│ ├── system/
|
||||||
|
│ │ ├── tasks/main.yml
|
||||||
|
│ │ ├── vars/main.yml
|
||||||
|
│ │ └── files/
|
||||||
|
│ ├── git/
|
||||||
|
│ │ ├── tasks/main.yml
|
||||||
|
│ │ ├── templates/
|
||||||
|
│ │ │ └── .gitconfig.j2
|
||||||
|
│ │ └── vars/main.yml
|
||||||
|
│ ├── neovim/
|
||||||
|
│ │ ├── tasks/main.yml
|
||||||
|
│ │ └── files/
|
||||||
|
│ └── zsh/
|
||||||
|
│ ├── tasks/main.yml
|
||||||
|
│ ├── files/
|
||||||
|
│ │ └── .zshrc
|
||||||
|
│ └── vars/main.yml
|
||||||
|
└── inventory
|
||||||
|
```
|
||||||
|
|
||||||
|
## Main Configuration (`group_vars/all.yml`)
|
||||||
|
```yaml
|
||||||
|
# Your system configuration
|
||||||
|
default_roles:
|
||||||
|
- system
|
||||||
|
- git
|
||||||
|
- neovim
|
||||||
|
- zsh
|
||||||
|
- docker
|
||||||
|
|
||||||
|
# Global variables
|
||||||
|
dotfiles_dir: "{{ ansible_env.HOME }}/dotfiles"
|
||||||
|
config_dir: "{{ ansible_env.HOME }}/.config"
|
||||||
|
|
||||||
|
# Git configuration
|
||||||
|
git_user_name: "Johannes"
|
||||||
|
git_user_email: "johannes@example.com"
|
||||||
|
git_editor: "nvim"
|
||||||
|
|
||||||
|
# System packages to install
|
||||||
|
system_packages:
|
||||||
|
- curl
|
||||||
|
- wget
|
||||||
|
- unzip
|
||||||
|
- tree
|
||||||
|
```
|
||||||
|
|
||||||
|
## Main Playbook (`playbook.yml`)
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- name: Setup development environment
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
become: yes
|
||||||
|
become_method: sudo
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Create btrfs snapshot before changes
|
||||||
|
shell: |
|
||||||
|
sudo btrfs subvolume snapshot / /.snapshots/before-dotfiles-$(date +%Y%m%d-%H%M%S)
|
||||||
|
ignore_errors: yes
|
||||||
|
tags: [snapshot]
|
||||||
|
|
||||||
|
roles: "{{ default_roles }}"
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: Summary of installed roles
|
||||||
|
debug:
|
||||||
|
msg: "Completed setup for: {{ default_roles | join(', ') }}"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Roles
|
||||||
|
|
||||||
|
### System Role (`roles/system/tasks/main.yml`)
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- name: Install system packages
|
||||||
|
package:
|
||||||
|
name: "{{ system_packages }}"
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Ensure .config directory exists
|
||||||
|
file:
|
||||||
|
path: "{{ config_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Set up shell as default
|
||||||
|
user:
|
||||||
|
name: "{{ ansible_env.USER }}"
|
||||||
|
shell: /usr/bin/zsh
|
||||||
|
when: "'zsh' in default_roles"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git Role (`roles/git/tasks/main.yml`)
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- name: Install git
|
||||||
|
package:
|
||||||
|
name: git
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Check if custom gitconfig exists
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||||
|
register: custom_gitconfig
|
||||||
|
|
||||||
|
- name: Use custom gitconfig if available
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/git/.gitconfig"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.gitconfig"
|
||||||
|
state: link
|
||||||
|
force: yes
|
||||||
|
when: custom_gitconfig.stat.exists
|
||||||
|
|
||||||
|
- name: Generate gitconfig from template if no custom config
|
||||||
|
template:
|
||||||
|
src: .gitconfig.j2
|
||||||
|
dest: "{{ ansible_env.HOME }}/.gitconfig"
|
||||||
|
mode: '0644'
|
||||||
|
when: not custom_gitconfig.stat.exists
|
||||||
|
```
|
||||||
|
|
||||||
|
### Git Template (`roles/git/templates/.gitconfig.j2`)
|
||||||
|
```ini
|
||||||
|
[user]
|
||||||
|
name = {{ git_user_name }}
|
||||||
|
email = {{ git_user_email }}
|
||||||
|
|
||||||
|
[core]
|
||||||
|
editor = {{ git_editor }}
|
||||||
|
autocrlf = input
|
||||||
|
|
||||||
|
[init]
|
||||||
|
defaultBranch = main
|
||||||
|
|
||||||
|
[push]
|
||||||
|
default = simple
|
||||||
|
```
|
||||||
|
|
||||||
|
### Neovim Role (`roles/neovim/tasks/main.yml`)
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- name: Install neovim
|
||||||
|
package:
|
||||||
|
name: neovim
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Check for custom neovim config
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/nvim"
|
||||||
|
register: nvim_config
|
||||||
|
|
||||||
|
- name: Symlink neovim config
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/nvim"
|
||||||
|
dest: "{{ config_dir }}/nvim"
|
||||||
|
state: link
|
||||||
|
force: yes
|
||||||
|
when: nvim_config.stat.exists
|
||||||
|
|
||||||
|
- name: Create basic neovim config if none exists
|
||||||
|
copy:
|
||||||
|
content: |
|
||||||
|
-- Basic Neovim configuration
|
||||||
|
vim.opt.number = true
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.tabstop = 2
|
||||||
|
vim.opt.shiftwidth = 2
|
||||||
|
dest: "{{ config_dir }}/nvim/init.lua"
|
||||||
|
mode: '0644'
|
||||||
|
when: not nvim_config.stat.exists
|
||||||
|
```
|
||||||
|
|
||||||
|
### ZSH Role (`roles/zsh/tasks/main.yml`)
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
- name: Install zsh
|
||||||
|
package:
|
||||||
|
name: zsh
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Install oh-my-zsh
|
||||||
|
shell: |
|
||||||
|
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended
|
||||||
|
args:
|
||||||
|
creates: "{{ ansible_env.HOME }}/.oh-my-zsh"
|
||||||
|
|
||||||
|
- name: Check for custom zshrc
|
||||||
|
stat:
|
||||||
|
path: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||||
|
register: custom_zshrc
|
||||||
|
|
||||||
|
- name: Symlink custom zshrc
|
||||||
|
file:
|
||||||
|
src: "{{ dotfiles_dir }}/zsh/.zshrc"
|
||||||
|
dest: "{{ ansible_env.HOME }}/.zshrc"
|
||||||
|
state: link
|
||||||
|
force: yes
|
||||||
|
when: custom_zshrc.stat.exists
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
**To install everything:**
|
||||||
|
```bash
|
||||||
|
ansible-playbook -i inventory playbook.yml --ask-become-pass
|
||||||
|
```
|
||||||
|
|
||||||
|
**To install only specific roles:**
|
||||||
|
```bash
|
||||||
|
ansible-playbook -i inventory playbook.yml --ask-become-pass --tags "git,neovim"
|
||||||
|
```
|
||||||
|
|
||||||
|
**To override roles temporarily:**
|
||||||
|
```bash
|
||||||
|
ansible-playbook -i inventory playbook.yml --ask-become-pass -e "default_roles=['system','git']"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benefits of This Approach
|
||||||
|
|
||||||
|
1. **Modular**: Each tool is a separate role
|
||||||
|
2. **Configurable**: Easy to enable/disable tools in `all.yml`
|
||||||
|
3. **Reusable**: Roles can be shared across different machines
|
||||||
|
4. **Flexible**: Can override variables per host/group
|
||||||
|
5. **Fallback configs**: Generates basic configs when custom ones don't exist
|
||||||
|
6. **Scalable**: Easy to add new tools without touching existing code
|
||||||
|
|
||||||
|
This approach lets you manage your entire development environment as code while keeping it organized and maintainable!
|
||||||
@ -124,3 +124,7 @@ export NVM_DIR="$HOME/.nvm"
|
|||||||
if [[ -n "$MACHINE_TYPE" && -f "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh" ]]; then
|
if [[ -n "$MACHINE_TYPE" && -f "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh" ]]; then
|
||||||
source "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh"
|
source "$HOME/dotfiles/zsh/hosts/$MACHINE_TYPE.zsh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
alias drun='docker run -it --network=host --device=/dev/kfd --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user