Compare commits
1
Commits
main
..
eace0f1c2d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eace0f1c2d |
@@ -1,27 +0,0 @@
|
|||||||
{{- $email := promptStringOnce . "email" "What's your email" }}
|
|
||||||
{{- $git_name := promptStringOnce . "git_name" "What's your Git name" }}
|
|
||||||
|
|
||||||
{{- $shell := promptBoolOnce . "features.shell" "Do you want to install the Fish shell" true }}
|
|
||||||
{{- $git := promptBoolOnce . "features.git" "Do you want to install Git" true }}
|
|
||||||
{{- $editor := promptBoolOnce . "features.editor" "Do you want to install Neovim" true }}
|
|
||||||
{{- $nix := promptBoolOnce . "features.nix" "Do you want to install the Nix package manager" true }}
|
|
||||||
{{- $terminal := promptBoolOnce . "features.terminal" "Do you want to install Wezterm" true }}
|
|
||||||
{{- $podman := promptBoolOnce . "features.podman" "Do you want to install Podman" true }}
|
|
||||||
|
|
||||||
{{- $paru := false -}}
|
|
||||||
{{ if eq .chezmoi.osRelease.id "arch" -}}
|
|
||||||
{{- $paru = promptBoolOnce . "features.paru" "Do you want to install the Paru package manager" true -}}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
[data]
|
|
||||||
email = {{ $email | quote }}
|
|
||||||
git_name = {{ $git_name | quote }}
|
|
||||||
|
|
||||||
[data.features]
|
|
||||||
shell = {{ $shell }}
|
|
||||||
git = {{ $git }}
|
|
||||||
editor = {{ $editor }}
|
|
||||||
nix = {{ $nix }}
|
|
||||||
paru = {{ $paru }}
|
|
||||||
terminal = {{ $terminal }}
|
|
||||||
podman = {{ $podman }}
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
@@ -1 +0,0 @@
|
|||||||
home
|
|
||||||
@@ -3,37 +3,17 @@
|
|||||||
# ~/.dotfiles 🏡
|
# ~/.dotfiles 🏡
|
||||||
|
|
||||||
[](https://chezmoi.io/)
|
[](https://chezmoi.io/)
|
||||||
[](https://ansible.com/)
|
|
||||||
[](https://choosealicense.com/licenses/mit/)
|
[](https://choosealicense.com/licenses/mit/)
|
||||||
|
|
||||||
</div><br>
|
</div><br>
|
||||||
|
|
||||||
> My dotfiles, managed with [chezmoi](https://chezmoi.io/) and
|
> My dotfiles, managed with [chezmoi](https://chezmoi.io/)
|
||||||
> [Ansible](https://ansible.com/)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Install [chezmoi](https://chezmoi.io/install/), then run:
|
Install [chezmoi](https://chezmoi.io/), then run:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Initialize the repository
|
|
||||||
chezmoi init git.nicolabelluti.me/nicolabelluti
|
chezmoi init git.nicolabelluti.me/nicolabelluti
|
||||||
# You can also just use
|
|
||||||
# `chezmoi init nicolabelluti`
|
|
||||||
# if you want to use the GitHub mirror
|
|
||||||
|
|
||||||
# Apply the dotfiles
|
|
||||||
chezmoi apply
|
chezmoi apply
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to update the dotfiles:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
chezmoi update --init
|
|
||||||
```
|
|
||||||
|
|
||||||
To give a new answer to the prompts:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
chezmoi init --prompt
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
../.chezmoi.toml.tmpl
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
{{- if not .features.shell }}
|
|
||||||
.config/fish
|
|
||||||
.config/starship.toml
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.git }}
|
|
||||||
.config/git
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.editor }}
|
|
||||||
.config/nvim
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.nix }}
|
|
||||||
.config/nix
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.paru }}
|
|
||||||
.config/paru
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.terminal }}
|
|
||||||
.config/wezterm
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if not .features.podman }}
|
|
||||||
.config/containers
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Check is the script is being run using chezmoi
|
|
||||||
{{- if false }}
|
|
||||||
echo "This script must be run using chezmoi! Aborting..."
|
|
||||||
exit 1
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
# Run this script only on Arch Linux
|
|
||||||
{{- if ne .chezmoi.osRelease.id "arch" }}
|
|
||||||
exit 0
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
# Make the script stop if something goes wrong:
|
|
||||||
# -e: any command fails
|
|
||||||
# -u: unset variable is used
|
|
||||||
# -o pipefail: a pipeline fails if any command fails
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# Show a clear error before exiting
|
|
||||||
SCRIPT_PATH="{{ trimPrefix "/" (trimPrefix .chezmoi.workingTree (joinPath .chezmoi.sourceDir .chezmoi.sourceFile)) }}"
|
|
||||||
trap 'echo -e "\n\033[1;31mError: Script \"$SCRIPT_PATH\" failed at line $LINENO\033[0m\n" >&2; exit 1' ERR
|
|
||||||
|
|
||||||
# </init>
|
|
||||||
# <core>
|
|
||||||
|
|
||||||
# Ask for confirmation before running the script
|
|
||||||
while true; do
|
|
||||||
read -p "Do you want to run the setup script? [Y/n]: " -n 1 -r REPLY
|
|
||||||
|
|
||||||
# Clear the input buffer and add a newline
|
|
||||||
while read -t 0.001 TMP; do continue; done
|
|
||||||
echo
|
|
||||||
|
|
||||||
# Convert to lowercase and default to 'y' if empty
|
|
||||||
REPLY=${REPLY:-y}
|
|
||||||
|
|
||||||
case $REPLY in
|
|
||||||
Y|y|1) break ;;
|
|
||||||
N|n|0) exit 0 ;;
|
|
||||||
*) echo "Invalid input. Please enter y or n." ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if python3 and python3-venv are installed
|
|
||||||
if ! command -v python3 >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[1;34mpython3 not found. Installing it...\e[0m"
|
|
||||||
sudo pacman --noconfirm -Sy python
|
|
||||||
fi
|
|
||||||
|
|
||||||
ANSIBLE_ROOT="{{ .chezmoi.workingTree }}/setup-script"
|
|
||||||
|
|
||||||
# If a venv exists, check if it's still valid
|
|
||||||
if [ -d "$ANSIBLE_ROOT/.venv" ]; then
|
|
||||||
VENV_PYTHON="$ANSIBLE_ROOT/.venv/bin/python3"
|
|
||||||
SYS_PYTHON_VERSION=$(python3 -c "import sys; print(sys.version_info[:2])")
|
|
||||||
VENV_OK=true
|
|
||||||
|
|
||||||
# Check if the Python binary inside the venv is functional
|
|
||||||
if ! "$VENV_PYTHON" --version >/dev/null 2>&1; then
|
|
||||||
echo -e "\e[1;33mVenv Python binary is broken.\e[0m"
|
|
||||||
VENV_OK=false
|
|
||||||
# Check if the venv Python version matches the system Python version
|
|
||||||
elif [ "$("$VENV_PYTHON" -c "import sys; print(sys.version_info[:2])")" != "$SYS_PYTHON_VERSION" ]; then
|
|
||||||
echo -e "\e[1;33mVenv Python version mismatch with system Python.\e[0m"
|
|
||||||
VENV_OK=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$VENV_OK" = false ]; then
|
|
||||||
echo -e "\e[1;34mDeleting the invalid venv...\e[0m"
|
|
||||||
rm -rf "$ANSIBLE_ROOT/.venv"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if there is a venv in "setup-script/"
|
|
||||||
if [ ! -d "$ANSIBLE_ROOT/.venv" ]; then
|
|
||||||
echo -e "\e[1;34mNo venv found in "$ANSIBLE_ROOT". Creating one...\e[0m"
|
|
||||||
python3 -m venv "$ANSIBLE_ROOT/.venv"
|
|
||||||
|
|
||||||
echo -e "\e[1;34mInstalling the dependencies...\e[0m"
|
|
||||||
"$ANSIBLE_ROOT/.venv/bin/pip3" install -r "$ANSIBLE_ROOT/requirements.txt"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run the playbook
|
|
||||||
echo -e "\e[1;34mRunning the playbook...\e[0m"
|
|
||||||
ANSIBLE_CONFIG="$ANSIBLE_ROOT/ansible.cfg" \
|
|
||||||
"$ANSIBLE_ROOT/.venv/bin/ansible-playbook" \
|
|
||||||
"$ANSIBLE_ROOT/playbook.yaml" \
|
|
||||||
--extra-vars "$(chezmoi data --format=json)" \
|
|
||||||
--ask-become-pass
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[engine]
|
|
||||||
compose_warning_logs = false
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
abbr --add --position command l ls -lAh
|
|
||||||
|
|
||||||
{{- if .features.editor }}
|
|
||||||
# Alias `vi` and `vim` to Neovim
|
|
||||||
abbr --add --position command vim nvim
|
|
||||||
abbr --add --position command vi nvim
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if .features.nix }}
|
|
||||||
abbr --add --position command nd 'nix develop --command $SHELL'
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
{{- if .features.editor }}
|
|
||||||
# Set Neovim to be the default editor
|
|
||||||
set --export EDITOR nvim
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Add `~/.local/bin` to PATH
|
|
||||||
set fish_user_paths {{ joinPath .chezmoi.homeDir ".local/bin" }}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Disable the default Fish greeting message
|
|
||||||
set fish_greeting ""
|
|
||||||
|
|
||||||
# Initialize Starship
|
|
||||||
starship init fish | source
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
[user]
|
|
||||||
email = {{ .email }}
|
|
||||||
name = {{ .git_name }}
|
|
||||||
|
|
||||||
[init]
|
|
||||||
defaultBranch = main
|
|
||||||
|
|
||||||
[merge]
|
|
||||||
ff = true
|
|
||||||
|
|
||||||
{{- $credentialHelperPath := "" }}
|
|
||||||
{{- if eq .chezmoi.osRelease.id "arch" }}
|
|
||||||
{{- $credentialHelperPath = "/usr/lib/git-core/git-credential-libsecret" }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- if $credentialHelperPath }}
|
|
||||||
[credential]
|
|
||||||
helper = {{ $credentialHelperPath }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
||||||
{{- $projectsDir := joinPath .chezmoi.homeDir "Projects" }}
|
|
||||||
{{- if stat $projectsDir }}
|
|
||||||
{{- $projects := output "find" "-L" $projectsDir "-type" "f" "-mindepth" "2" "-maxdepth" "2" "-name" ".gitconfig" | trim | splitList "\n" }}
|
|
||||||
{{- range $projects }}
|
|
||||||
{{- if . }}
|
|
||||||
[includeIf "gitdir:{{ . | dir }}/**/"]
|
|
||||||
path = {{ . }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# Enable Nix flakes
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
require("settings")
|
|
||||||
require("lazy-nvim")
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
-- https://lazy.folke.io/installation
|
|
||||||
|
|
||||||
-- Bootstrap lazy.nvim
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
||||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
||||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
|
||||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
|
||||||
if vim.v.shell_error ~= 0 then
|
|
||||||
vim.api.nvim_echo({
|
|
||||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
|
||||||
{ out, "WarningMsg" },
|
|
||||||
{ "\nPress any key to exit..." },
|
|
||||||
}, true, {})
|
|
||||||
vim.fn.getchar()
|
|
||||||
os.exit(1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
vim.opt.rtp:prepend(lazypath)
|
|
||||||
|
|
||||||
-- Setup lazy.nvim
|
|
||||||
require("lazy").setup({
|
|
||||||
spec = {
|
|
||||||
-- Import `plugins/` dir
|
|
||||||
{ import = "plugins" },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Automatically check for plugin updates
|
|
||||||
checker = { enabled = true },
|
|
||||||
})
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
return {
|
|
||||||
'nvim-tree/nvim-tree.lua',
|
|
||||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
|
||||||
lazy = false,
|
|
||||||
keys = {
|
|
||||||
{ '<leader>e', '<cmd>NvimTreeToggle<CR>', desc = 'Toggle file explorer' },
|
|
||||||
},
|
|
||||||
init = function()
|
|
||||||
-- disable netrw
|
|
||||||
vim.g.loaded_netrw = 1
|
|
||||||
vim.g.loaded_netrwPlugin = 1
|
|
||||||
end,
|
|
||||||
config = function()
|
|
||||||
require('nvim-tree').setup({
|
|
||||||
view = { width = 32 },
|
|
||||||
sync_root_with_cwd = true,
|
|
||||||
update_focused_file = { enable = true },
|
|
||||||
|
|
||||||
actions = {
|
|
||||||
open_file = {
|
|
||||||
window_picker = { enable = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
on_attach = function(bufnr)
|
|
||||||
local api = require('nvim-tree.api')
|
|
||||||
|
|
||||||
-- Keep all default keymaps
|
|
||||||
api.config.mappings.default_on_attach(bufnr)
|
|
||||||
|
|
||||||
local function opts(desc)
|
|
||||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Swap 'd'/'D'
|
|
||||||
vim.keymap.set({ 'n', 'x' }, 'd', api.fs.trash, opts('Trash'))
|
|
||||||
vim.keymap.set({ 'n', 'x' }, 'D', api.fs.remove, opts('Delete'))
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
return {
|
|
||||||
'akinsho/toggleterm.nvim',
|
|
||||||
keys = {
|
|
||||||
{ '<leader>t', '<cmd>ToggleTerm direction=horizontal<CR>', desc = 'Toggle terminal' },
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
direction = 'horizontal',
|
|
||||||
size = 15,
|
|
||||||
open_mapping = nil,
|
|
||||||
shade_terminals = true,
|
|
||||||
start_in_insert = true,
|
|
||||||
persist_size = true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
return {
|
|
||||||
'nvim-treesitter/nvim-treesitter',
|
|
||||||
branch = 'main',
|
|
||||||
lazy = false,
|
|
||||||
build = ':TSUpdate',
|
|
||||||
config = function()
|
|
||||||
-- Old `ensure_installed`
|
|
||||||
require('nvim-treesitter').install({
|
|
||||||
-- Neovim config
|
|
||||||
'lua', 'vim', 'vimdoc', 'query',
|
|
||||||
|
|
||||||
-- Rust
|
|
||||||
'rust', 'toml',
|
|
||||||
|
|
||||||
-- Ansible
|
|
||||||
'yaml',
|
|
||||||
|
|
||||||
-- Frontend stuff
|
|
||||||
'html', 'css', 'javascript', 'typescript', 'tsx', 'json',
|
|
||||||
|
|
||||||
-- Low level stuff
|
|
||||||
'c', 'asm',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Old `auto_install`
|
|
||||||
local ts_autoinstall_group = vim.api.nvim_create_augroup('TSAutoInstall', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
group = ts_autoinstall_group,
|
|
||||||
callback = function(args)
|
|
||||||
-- Skip UI/special buffers (file explorers, help, terminals, quickfix, ecc.)
|
|
||||||
if vim.bo[args.buf].buftype ~= '' then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local lang = vim.treesitter.language.get_lang(args.match) or args.match
|
|
||||||
|
|
||||||
-- Try starting right away: if it works, the parser was already installed
|
|
||||||
if pcall(vim.treesitter.start, args.buf, lang) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Didn't work: download the parser in the background
|
|
||||||
local ok = pcall(function()
|
|
||||||
require('nvim-treesitter').install({ lang }, { summary = false })
|
|
||||||
end)
|
|
||||||
if not ok then return end
|
|
||||||
|
|
||||||
-- Poll (non-blocking) until start() succeeds, or give up after 9s
|
|
||||||
local function try_start(attempts)
|
|
||||||
attempts = attempts or 0
|
|
||||||
if pcall(vim.treesitter.start, args.buf, lang) then
|
|
||||||
return
|
|
||||||
elseif attempts < 30 then
|
|
||||||
vim.defer_fn(function() try_start(attempts + 1) end, 300)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
try_start()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
-- Leader key
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.maplocalleader = "\\"
|
|
||||||
|
|
||||||
-- Enable relative line numbers
|
|
||||||
vim.opt.number = true
|
|
||||||
vim.opt.relativenumber = true
|
|
||||||
|
|
||||||
-- GUI stuff
|
|
||||||
vim.opt.cursorline = true -- Highlight the current line
|
|
||||||
vim.opt.colorcolumn = "80,120" -- Show vertical ruler
|
|
||||||
vim.opt.scrolloff = 8 -- Keep at least 8 lines between the cursor and the borders
|
|
||||||
vim.opt.wrap = false -- Don't wrap long lines
|
|
||||||
vim.opt.laststatus = 3 -- Single global status bar
|
|
||||||
vim.opt.fillchars = { eob = ' ' } -- Don't put `~` at the end of buffer
|
|
||||||
|
|
||||||
-- Show whitespace characters (tabs, trailing spaces, etc.)
|
|
||||||
vim.opt.list = true
|
|
||||||
vim.opt.listchars = { tab = '» ', trail = '·', multispace = '·', nbsp = '␣' }
|
|
||||||
|
|
||||||
-- Strip trailing whitespace and extra blank lines at end of file on save
|
|
||||||
local trim_group = vim.api.nvim_create_augroup('TrimOnSave', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = trim_group,
|
|
||||||
pattern = '*',
|
|
||||||
callback = function()
|
|
||||||
local save_view = vim.fn.winsaveview()
|
|
||||||
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
|
||||||
vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines
|
|
||||||
vim.fn.winrestview(save_view) -- Restore the window to where it was before the edits
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Remove background opacity
|
|
||||||
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
|
|
||||||
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' })
|
|
||||||
|
|
||||||
-- Remember old sessions
|
|
||||||
vim.opt.undofile = true
|
|
||||||
local restore_cursor_group = vim.api.nvim_create_augroup('RestoreCursor', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('BufReadPost', {
|
|
||||||
group = restore_cursor_group,
|
|
||||||
callback = function()
|
|
||||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
|
||||||
local last_line = vim.api.nvim_buf_line_count(0)
|
|
||||||
if mark[1] > 0 and mark[1] <= last_line then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_win_set_cursor(0, mark)
|
|
||||||
vim.cmd.normal({ 'zz', bang = true })
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Indentation
|
|
||||||
vim.opt.tabstop = 4 -- Visual width of a tab character
|
|
||||||
vim.opt.softtabstop = 4 -- Spaces inserted/deleted per Tab/Backspace in insert mode
|
|
||||||
vim.opt.shiftwidth = 4 -- Width used by >>, <<, and autoindent
|
|
||||||
vim.opt.expandtab = true -- Typed tabs become spaces
|
|
||||||
vim.opt.smartindent = true -- Auto-indent new lines based on syntax (e.g. after '{')
|
|
||||||
|
|
||||||
-- Search
|
|
||||||
vim.opt.ignorecase = true -- Case-insensitive search...
|
|
||||||
vim.opt.smartcase = true -- ...unless you type an explicit uppercase letter
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
[options]
|
|
||||||
# Reverse sort order of search results
|
|
||||||
BottomUp
|
|
||||||
|
|
||||||
# Remove makedeps unconditionally after install
|
|
||||||
RemoveMake
|
|
||||||
|
|
||||||
# Refresh sudo timestamp to avoid sudo re-prompts
|
|
||||||
SudoLoop
|
|
||||||
|
|
||||||
# Skip review of build files
|
|
||||||
SkipReview
|
|
||||||
|
|
||||||
# Remove build files after install
|
|
||||||
CleanAfter
|
|
||||||
|
|
||||||
# Show a menu to select packages during upgrades
|
|
||||||
UpgradeMenu
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
local wezterm = require 'wezterm'
|
|
||||||
local config = wezterm.config_builder()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return config
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
AddKeysToAgent yes
|
|
||||||
User root
|
|
||||||
IdentityFile ~/.ssh/keys/default
|
|
||||||
|
|
||||||
Include hosts
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#
|
|
||||||
# SSH per-host connection settings (user, keys, options, etc.)
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
#
|
|
||||||
# ```
|
|
||||||
# Host host.example.org
|
|
||||||
# User user
|
|
||||||
# IdentityFile ~/.ssh/keys/private-key
|
|
||||||
# ```
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
.ansible
|
|
||||||
.venv
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
[defaults]
|
|
||||||
# (path) The default root path for Ansible config files on the controller.
|
|
||||||
home=./.ansible
|
|
||||||
|
|
||||||
# (boolean) If you have cowsay installed but want to avoid the 'cows' (why????), use this.
|
|
||||||
nocows = true
|
|
||||||
|
|
||||||
# (pathspec) Colon separated paths in which Ansible will search for Roles.
|
|
||||||
roles_path = ./roles
|
|
||||||
|
|
||||||
# (boolean) By default, Ansible will issue a warning when there are no hosts in the inventory.
|
|
||||||
# These warnings can be silenced by adjusting this setting to False.
|
|
||||||
localhost_warning = false
|
|
||||||
|
|
||||||
# (str) Define the task result format used in the callback output.
|
|
||||||
# These formats do not cause the callback to emit valid JSON or YAML formats.
|
|
||||||
# The output contains these formats interspersed with other non-machine parsable data.
|
|
||||||
callback_result_format = yaml
|
|
||||||
|
|
||||||
[diff]
|
|
||||||
# (bool) Configuration toggle to tell modules to show differences when in 'changed' status, equivalent to ``--diff``.
|
|
||||||
always = true
|
|
||||||
|
|
||||||
[inventory]
|
|
||||||
# (boolean) By default, Ansible will issue a warning when no inventory was loaded and notes that it will use an implicit localhost-only inventory.
|
|
||||||
# These warnings can be silenced by adjusting this setting to False.
|
|
||||||
inventory_unparsed_warning = false
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
- name: Prepare the base environment
|
|
||||||
hosts: localhost
|
|
||||||
connection: local
|
|
||||||
gather_facts: false
|
|
||||||
|
|
||||||
pre_tasks:
|
|
||||||
- name: Ensure the "chezmoi" variable is set
|
|
||||||
ansible.builtin.assert:
|
|
||||||
that:
|
|
||||||
- chezmoi is not undefined
|
|
||||||
- chezmoi is mapping
|
|
||||||
fail_msg: 'Pass with: --extra-vars "$(chezmoi data --format=json)"'
|
|
||||||
|
|
||||||
- name: Verify the become password is correct
|
|
||||||
become: true
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "true"
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Verify the distro
|
|
||||||
ansible.builtin.debug:
|
|
||||||
msg: "The setup script for now supports only Arch Linux!"
|
|
||||||
when: chezmoi.osRelease.id != "arch"
|
|
||||||
|
|
||||||
roles:
|
|
||||||
- role: shell
|
|
||||||
when: features.shell == true
|
|
||||||
- role: git
|
|
||||||
when: features.git == true
|
|
||||||
- role: editor
|
|
||||||
when: features.editor == true
|
|
||||||
- role: nix
|
|
||||||
when: features.nix == true
|
|
||||||
- role: paru
|
|
||||||
when: chezmoi.osRelease.id == "arch" and features.paru == true
|
|
||||||
- role: terminal
|
|
||||||
when: chezmoi.osRelease.id == "arch" and features.terminal == true
|
|
||||||
- role: podman
|
|
||||||
when: chezmoi.osRelease.id == "arch" and features.podman == true
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ansible == 12.0.0
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
- name: Install Neovim on Arch
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: neovim
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
|
|
||||||
- name: Install the clipboard manager
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: "{{ 'wl-clipboard' if lookup('env', 'XDG_SESSION_TYPE') == 'wayland' else 'xclip' }}"
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
|
|
||||||
- name: Install plugin dependencies
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name:
|
|
||||||
# nvim-treesitter
|
|
||||||
- tree-sitter-cli
|
|
||||||
- gcc
|
|
||||||
- curl
|
|
||||||
- tar
|
|
||||||
|
|
||||||
# nvim-tree
|
|
||||||
- trash-cli
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
- name: Install Git on Arch
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: git
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
- name: Install Nix on Arch
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: nix
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
|
|
||||||
- name: Start the Nix daemon
|
|
||||||
become: true
|
|
||||||
ansible.builtin.systemd_service:
|
|
||||||
name: nix-daemon
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
- name: Check if paru is already installed
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv:
|
|
||||||
- pacman
|
|
||||||
- -Qq
|
|
||||||
- paru
|
|
||||||
register: is_paru_installed
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Stop the role if paru is already installed
|
|
||||||
when: is_paru_installed.rc == 0
|
|
||||||
ansible.builtin.meta: end_role
|
|
||||||
|
|
||||||
- name: Create temporary dir for build
|
|
||||||
ansible.builtin.tempfile:
|
|
||||||
state: directory
|
|
||||||
suffix: paru
|
|
||||||
register: paru_tmp
|
|
||||||
|
|
||||||
- name: Download the AUR snapshot
|
|
||||||
ansible.builtin.get_url:
|
|
||||||
url: "https://aur.archlinux.org/cgit/aur.git/snapshot/paru.tar.gz"
|
|
||||||
dest: "{{ paru_tmp.path }}/paru.tar.gz"
|
|
||||||
|
|
||||||
- name: Extract the snapshot
|
|
||||||
ansible.builtin.unarchive:
|
|
||||||
src: "{{ paru_tmp.path }}/paru.tar.gz"
|
|
||||||
dest: "{{ paru_tmp.path }}"
|
|
||||||
remote_src: true
|
|
||||||
|
|
||||||
- name: Read the package metadata
|
|
||||||
ansible.builtin.slurp:
|
|
||||||
src: "{{ paru_tmp.path }}/paru/.SRCINFO"
|
|
||||||
register: paru_srcinfo
|
|
||||||
|
|
||||||
- name: Extract build and runtime dependencies
|
|
||||||
ansible.builtin.set_fact:
|
|
||||||
paru_build_deps: >-
|
|
||||||
{{ (paru_srcinfo.content | b64decode)
|
|
||||||
| regex_findall('(?m)^\s*(?:make|check)?depends(?:_\w+)?\s*=\s*([^\s<>=]+)')
|
|
||||||
| unique }}
|
|
||||||
|
|
||||||
- name: Ensure build prerequisites are present
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: "{{ ['base-devel', 'fakeroot'] + paru_build_deps }}"
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Build the package (no install)
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv:
|
|
||||||
- makepkg
|
|
||||||
- --noconfirm
|
|
||||||
chdir: "{{ paru_tmp.path }}/paru"
|
|
||||||
environment:
|
|
||||||
PKGDEST: "{{ paru_tmp.path }}/paru"
|
|
||||||
|
|
||||||
- name: Locate built package(s)
|
|
||||||
ansible.builtin.find:
|
|
||||||
paths: "{{ paru_tmp.path }}/paru"
|
|
||||||
patterns: "*.pkg.tar.zst"
|
|
||||||
excludes: "*-debug-*"
|
|
||||||
file_type: file
|
|
||||||
register: built_pkgs
|
|
||||||
|
|
||||||
# Install with root, but OUTSIDE makepkg
|
|
||||||
- name: Install built package(s)
|
|
||||||
become: true
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv:
|
|
||||||
- pacman
|
|
||||||
- -U
|
|
||||||
- --noconfirm
|
|
||||||
- "{{ item.path }}"
|
|
||||||
creates: /usr/bin/paru
|
|
||||||
loop: "{{ built_pkgs.files }}"
|
|
||||||
|
|
||||||
- name: Remove temporary directory
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: "{{ paru_tmp.path }}"
|
|
||||||
state: absent
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
- name: Install Podman and related packages
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name:
|
|
||||||
- podman
|
|
||||||
- podman-compose
|
|
||||||
- slirp4netns # rootless mode networking (without slirp4netns, rootless containers have no network access)
|
|
||||||
- fuse-overlayfs # overlay storage driver for rootless mode (without it, rootless Podman uses a slower/less efficient driver)
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Ensure the user has subuid/subgid configured
|
|
||||||
become: true
|
|
||||||
ansible.builtin.command:
|
|
||||||
argv:
|
|
||||||
- usermod
|
|
||||||
- --add-subuids
|
|
||||||
- 100000-165535
|
|
||||||
- --add-subgids
|
|
||||||
- 100000-165535
|
|
||||||
- "{{ lookup('env', 'USER') }}"
|
|
||||||
when: lookup('env', 'USER') != "root"
|
|
||||||
changed_when: false
|
|
||||||
|
|
||||||
- name: Enable the podman.socket service for the user (Docker-compatible API)
|
|
||||||
ansible.builtin.systemd:
|
|
||||||
name: podman.socket
|
|
||||||
scope: user
|
|
||||||
enabled: true
|
|
||||||
state: started
|
|
||||||
become: false
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
- name: Install Fish shell and Starship on Arch
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name:
|
|
||||||
- fish
|
|
||||||
- starship
|
|
||||||
- ttf-nerd-fonts-symbols # Required for Starship
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
|
|
||||||
- name: Find Fish shell binary
|
|
||||||
command: which fish
|
|
||||||
register: fish_path
|
|
||||||
changed_when: false
|
|
||||||
failed_when: fish_path.rc != 0
|
|
||||||
|
|
||||||
- name: Set the user's shell
|
|
||||||
become: true
|
|
||||||
ansible.builtin.user:
|
|
||||||
name: "{{ chezmoi.username }}"
|
|
||||||
shell: "{{ fish_path.stdout }}"
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
- name: Install Neovim on Arch
|
|
||||||
become: true
|
|
||||||
ansible.builtin.pacman:
|
|
||||||
name: wezterm
|
|
||||||
when: chezmoi.osRelease.id == "arch"
|
|
||||||
Reference in New Issue
Block a user