My dotfiles, managed with:
- Font: JetBrains Mono
- Theme: Kanagawa
- Leader:
Ctrl+Shift
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin init --apply fredrdz
This will install Chezmoi via the appropriate package manager and immediately pull down the dotfiles repo to ~/.local/share/chezmoi/
. Then it will apply the dotfiles to the system.
The following happens as part of --apply
:
- Pre-install scripts execute.
- A secrets manager is installed if not found.
- Primary decryption occurs to enable the secrets manager used as the secondary layer of security.
- Install script executes.
- The main install scripts runs which installs my apps + setups my environment.
đź’ˇ Notice: The above mentioned scripts only execute once during the initial install since they are labeled with
run_once_
. Only scripts labeled asrun_onchange_
orrun_
may run multiple times. For more info:Chezmoi Scripts
.
This script automatically runs to decrypt a passphrase via the chezmoi age
command.
View Script
#!/bin/sh | |
DIR="${HOME}/.config/chezmoi" | |
if [ ! -f "${DIR}/chezmoi.key" ]; then | |
mkdir -p "${DIR}" | |
chezmoi age decrypt --output "${DIR}/chezmoi.key" --passphrase "{{ .chezmoi.sourceDir }}/chezmoi.key.age" | |
chmod 600 "${DIR}/chezmoi.key" | |
chezmoi decrypt "{{ .chezmoi.sourceDir }}/encrypted_dot_zshenv.age" >> "${HOME}/.zshenv" | |
fi |
This pre-install script runs to install and use Bitwarden Secrets.
View Script
#!/bin/sh | |
# exit immediately if password-manager-binary is already in $PATH | |
type bws >/dev/null 2>&1 && exit | |
# detect the OS using uname -s | |
OS=$(uname -s) | |
case $OS in | |
Linux) | |
if [ -f /etc/os-release ]; then | |
# source the OS release file to get distribution information | |
. /etc/os-release | |
case $ID in | |
# fedora/rhel systems; tested on amazon linux 2, fedora 39, and nobara 39 | |
amzn) | |
sudo yum update -y | |
sudo yum install -y perl perl-App-cpanminus.noarch | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
~/.cargo/bin/cargo install bws | |
;; | |
fedora) | |
sudo dnf update -y | |
sudo dnf install perl -y | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
~/.cargo/bin/cargo install bws | |
;; | |
nobara) | |
sudo dnf update rpmfusion-nonfree-release rpmfusion-free-release fedora-repos nobara-repos --refresh && sudo dnf distro-sync --refresh && sudo dnf update --refresh | |
sudo dnf install perl -y | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
~/.cargo/bin/cargo install bws | |
;; | |
*) | |
echo "Unsupported Linux distribution: $ID" | |
exit 1 | |
;; | |
esac | |
else | |
echo "Unable to detect the Linux distribution." | |
exit 1 | |
fi | |
;; | |
Darwin) | |
curl https://bws.bitwarden.com/install | sh | |
;; | |
*) | |
echo "Unsupported OS: $OS" | |
exit 1 | |
;; | |
esac |
View Script
dotfiles/.chezmoiscripts/run_once_install-packages.sh.tmpl
Lines 1 to 271 in 84856a3
#!/bin/bash | |
# author: Fredy Rodriguez | |
# note: uses golang templates to generate bash script | |
# to see chezmoi vars | |
# use: chezmoi data | |
packages-dnf() { | |
sudo dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm | |
sudo dnf -y install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm | |
sudo dnf update -y | |
sudo dnf install -y util-linux-user zsh make cmake sshuttle tmux xclip xsel yp-tools \ | |
libgit2-devel libssh2-devel openssl-devel pkg-config g++ gcc gcc-c++ perl podman \ | |
httpie htop wget ninja-build libtool openssh-server gh btop autossh \ | |
clang libevent-devel luarocks openssl net-tools jq go neovim tree ffmpeg \ | |
flatpak nodejs ripgrep vim docker iotop iftop speedtest-cli libusb1-devel.x86_64 | |
sudo dnf groupinstall -y 'Development Tools' 'Development Libraries' | |
sudo dnf install -y 'dnf-command(copr)' | |
sudo dnf copr enable atim/lazygit -y | |
sudo dnf install -y lazygit | |
sudo dnf copr enable @caddy/caddy -y | |
sudo dnf install -y caddy | |
# sudo dnf module install -y nodejs:18/common | |
} | |
packages-node() { | |
sudo npm install -g diff-so-fancy netlify-cli npm-check-updates | |
netlify completion:install | |
} | |
packages-golang() { | |
go install github.com/Gelio/go-global-update@latest | |
go install github.com/walles/moar@latest | |
go install github.com/dundee/gdu/v5/cmd/gdu@latest | |
go install sigs.k8s.io/kind@v0.17.0 | |
go install github.com/mikefarah/yq/v4@latest | |
go install github.com/TheZoraiz/ascii-image-converter@latest | |
go install github.com/sensepost/gowitness@latest | |
go install github.com/zsa/wally-cli@latest | |
go install github.com/ivaaaan/smug@latest | |
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest | |
go install github.com/air-verse/air@latest | |
go install github.com/charmbracelet/glow@latest | |
go install filippo.io/age/cmd/...@latest | |
go install github.com/goreleaser/goreleaser/v2@latest | |
go install github.com/a-h/templ/cmd/templ@latest | |
go install github.com/wailsapp/wails/v2/cmd/wails@latest | |
go install github.com/magefile/mage@latest | |
go install github.com/raviqqe/muffet/v2@latest | |
go install github.com/koblas/s3-cli@latest | |
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest | |
} | |
packages-rust() { | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
~/.cargo/bin/cargo install navi zoxide eza starship bat tree-sitter-cli bottom bws | |
~/.cargo/bin/cargo install cargo-update | |
} | |
packages-flatpak() { | |
# flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo | |
flatpak install flathub org.wezfurlong.wezterm org.signal.Signal com.slack.Slack com.google.Chrome com.discordapp.Discord com.brave.Browser | |
} | |
packages-virtualization() { | |
# virtualization | |
# sudo vi /etc/libvirt/libvirtd.conf | |
# unix_sock_group = "libvirt" | |
# unix_sock_rw_perms = "0770" | |
sudo dnf install -y @virtualization | |
sudo systemctl enable libvirtd | |
sudo systemctl start libvirtd | |
sudo usermod -a -G libvirt $(whoami) | |
} | |
packages-docker() { | |
sudo dnf -y install dnf-plugins-core | |
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo | |
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
sudo systemctl enable docker.service | |
sudo systemctl enable containerd.service | |
sudo systemctl start docker | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker | |
} | |
packages-php() { | |
sudo dnf install -y php | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
sudo mv wp-cli.phar /usr/local/bin/wp | |
} | |
packages-aws() { | |
tempfile=$(mktemp) && | |
curl -o $tempfile "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" && | |
unzip $tempfile -d /tmp/ && | |
sudo /tmp/aws/install && | |
rm $tempfile /tmp/aws -rf | |
} | |
packages-cloudflare-warp() { | |
# we are installing for fedora | |
# link to other distro pkgs: https://pkg.cloudflareclient.com/ | |
# if linux issue = DNS connectivity check failed | |
# https://developers.cloudflare.com/cloudflare-one/faq/teams-troubleshooting/#warp-on-linux-shows-dns-connectivity-check-failed | |
curl -fsSl https://pkg.cloudflareclient.com/cloudflare-warp-ascii.repo | sudo tee /etc/yum.repos.d/cloudflare-warp.repo | |
sudo dnf update -y | |
sudo dnf install -y cloudflare-warp | |
# completions | |
warp-cli generate-completions zsh >~/.oh-my-zsh/completions/_warp-cli | |
} | |
settings-development() { | |
# bun install | |
curl -fsSL https://bun.sh/install | bash | |
# fzf install | |
~/.fzf/install | |
# chezmoi completions | |
mkdir -p ~/.oh-my-zsh/completions/ | |
chezmoi completion zsh --output=~/.oh-my-zsh/completions/_chezmoi | |
# bws completions | |
bws completions zsh >~/.oh-my-zsh/completions/_bws | |
# go releaser completions | |
goreleaser completion zsh >~/.oh-my-zsh/completions/_goreleaser | |
# wezterm terminfo | |
tempfile=$(mktemp) && | |
curl -o $tempfile https://raw.githubusercontent.com/wez/wezterm/main/termwiz/data/wezterm.terminfo && | |
tic -x -o ~/.terminfo $tempfile && | |
rm $tempfile | |
# xterm-256color-italic terminfo | |
curl --silent \ | |
https://gist.githubusercontent.com/sadsfae/0b4dd18670639f7dce941a1b2a9e4e9e/raw/908b48e6b6370da0568be8d138966c60240a50dd/xterm-256color-italic.terminfo \ | |
>~/Documents/xterm-256color-italic | |
tic ~/Documents/xterm-256color-italic | |
# nerd-fonts JetBrainsMono install | |
wget https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/JetBrainsMono.zip -P ~/Documents/ | |
mkdir ~/.local/share/fonts | |
unzip ~/Documents/JetBrainsMono.zip -d ~/.local/share/fonts/ | |
fc-cache ~/.local/share/fonts | |
# timezone set | |
sudo timedatectl set-timezone America/Chicago | |
} | |
settings-locale() { | |
sudo dnf install glibc-langpack-en | |
sudo localectl set-locale LANG=en_US.UTF-8 | |
} | |
packages-desktop() { | |
sudo dnf install -y xprop xwininfo xdotool xrandr xev vlc mpv chromium gtk3 webkit2gtk3 \ | |
'pkgconfig(libudev)' | |
## tdrop | |
# git clone https://github.com/noctuid/tdrop | |
# sudo make install | |
## swhkd | |
# git clone https://github.com/waycrate/swhkd | |
# cd swhkd | |
# make setup | |
# make clean | |
# make | |
# sudo make install | |
# sudo ln -s ~/.config/swhkd/swhkdrc /etc/swhkd/swhkdrc | |
## enable via systemd service | |
## https://github.com/waycrate/swhkd/tree/main/contrib/init/systemd | |
# ssh | |
sudo systemctl enable sshd | |
sudo systemctl start sshd | |
# wezterm | |
wezterm shell-completion --shell zsh >~/.oh-my-zsh/completions/_wezterm | |
} | |
{{ if eq .osid "darwin" }} | |
echo "Detected MacOS" | |
echo "Do you want to continue with installs?(yes/no)" | |
read input | |
if [ "$input" == "yes" ]; then | |
# shell | |
chsh -s /bin/zsh | |
# brew cli apps | |
brew install zsh make cmake sshuttle tmux xclip xsel perl podman gcc httpie htop wget gh btop autossh luarocks openssl jq go neovim tree ffmpeg ninja libtool pkg-config libgit2 libevent nodejs ripgrep vim iftop gotop speedtest-cli lazygit caddy fzf navi zoxide eza starship bat bottom diff-so-fancy netlify-cli npm-check-updates php wp-cli coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep google-cloud-sdk wine-stable winetricks mono sdl2 faudio zlib sqlc automake yarn cloudflare-wrangler2 scriptisto npx nsis git-delta riff git-lfs fastfetch chroma golangci-lint | |
brew tap homebrew/services | |
# golang | |
packages-golang | |
# env/dev settings | |
settings-development | |
# brew casks | |
brew install --cask keymapp google-chrome firefox brave-browser slack discord iina vlc mpv bitwarden visual-studio-code cloudflare-warp tor-browser docker chatgpt signal notion figma claude raycast | |
# fonts | |
brew install --cask font-jetbrains-mono-nerd-font | |
# windows management | |
brew install --cask nikitabobko/tap/aerospace | |
brew tap FelixKratz/formulae | |
brew install borders | |
# completions | |
netlify completion:install | |
warp-cli generate-completions zsh >~/.oh-my-zsh/completions/_warp-cli | |
fi | |
{{ else if eq .osid "linux-fedora" }} | |
echo "Detected Fedora" | |
echo "Do you want to continue with installs?(yes/no)" | |
read input | |
if [ "$input" == "yes" ]; then | |
# dnf | |
packages-dnf | |
# shell | |
chsh -s /usr/bin/zsh | |
# php | |
packages-php | |
# rust | |
packages-rust | |
# golang | |
packages-golang | |
# node | |
packages-node | |
# aws | |
packages-aws | |
# env/dev settings | |
settings-development | |
# chezmoi | |
cd ~/.local/share/chezmoi/ && git remote set-url origin git@github.com:fredrdz/dotfiles.git && cd - | |
fi | |
{{ else if eq .osid "linux-nobara" }} | |
echo "Detected Nobara" | |
echo "Do you want to continue with installs?(yes/no)" | |
read input | |
if [ "$input" == "yes" ]; then | |
# dnf | |
packages-dnf | |
# shell | |
chsh -s /usr/bin/zsh | |
# php | |
packages-php | |
# rust | |
packages-rust | |
# golang | |
packages-golang | |
# node | |
packages-node | |
# aws | |
packages-aws | |
# env/dev settings | |
settings-development | |
# virtualization | |
settings-virtualization | |
# desktop | |
packages-desktop | |
# flatpak | |
packages-flatpak | |
fi | |
{{ else if eq .osid "linux-steamos" }} | |
echo "Detected Steam OS / Steam Deck" | |
echo "Do you want to continue with installs?(yes/no)" | |
read input | |
if [ "$input" == "yes" ]; then | |
# STEAM DECK ONLY | |
passwd | |
sudo steamos-readonly disable | |
sudo pacman-key --init | |
sudo pacman-key --populate archlinux | |
sudo pacman -Sy | |
sudo steamos-readonly enable | |
fi | |
{{ end }} |
chezmoi apply -v # apply with verbose output
chezmoi diff # diff between local repo and what's applied to the system
chezmoi data --format=yaml # writes the computed template data to stdout
# force scripts to re-run
chezmoi state delete-bucket --bucket=entryState # clear state of `run_onchange_` scripts
chezmoi state delete-bucket --bucket=scriptState # clear state of `run_once_` scripts
Link to the available Chezmoi commands.