Personal dotfiles managed with GNU Stow.
Chinese guide: README.zh-Hans.md
This repository is meant to restore my core development and desktop configuration on common Linux distributions, including Arch Linux, Debian/Ubuntu, and Fedora. It should contain reproducible configuration, not caches, login sessions, or plaintext secrets.
Each top-level directory is a Stow package. The package mirrors the target path under $HOME.
Example:
dotfiles/
├── zsh/
│ ├── .zshrc
│ ├── .zprofile
│ ├── .zshenv
│ └── .p10k.zsh
├── git/
│ └── .gitconfig
├── niri/
│ └── .config/niri/
└── micro/
└── .config/micro/
After running Stow:
~/.zshrc -> ~/dotfiles/zsh/.zshrc
~/.gitconfig -> ~/dotfiles/git/.gitconfig
~/.config/micro -> ~/dotfiles/micro/.config/micro
Arch Linux:
sudo pacman -S stow gitDebian / Ubuntu:
sudo apt update
sudo apt install stow gitFedora:
sudo dnf install stow gitOptional tools for encrypted secrets and per-project environment variables:
Arch Linux:
sudo pacman -S sops age direnvDebian / Ubuntu:
sudo apt install sops age direnvFedora:
sudo dnf install sops age direnvAlways preview first:
cd ~/dotfiles
./stow.sh zsh
./stow.sh --apply zshApply multiple packages explicitly:
cd ~/dotfiles
./stow.sh --apply zsh git microDo not blindly run stow -t ~ *, because directories such as secrets/ are not meant to be Stow packages.
Unstow one package:
cd ~/dotfiles
stow -D -t ~ zshRestow one package:
cd ~/dotfiles
stow -R -t ~ zsh.github/workflows/sync-to-cnb.yml mirrors GitHub pushes to CNB:
https://cnb.cool/Nesoriel/YangYuS8/dotfiles
Configure this GitHub Actions repository secret:
CNB_TOKEN
CNB Git HTTPS authentication uses the fixed username cnb and an access token as the password. The token needs write access to the target CNB repository.
Example: add ~/.gitconfig:
cd ~/dotfiles
mkdir -p git
mv ~/.gitconfig git/
stow -nv -t ~ git
stow -v -t ~ gitExample: add ~/.config/alacritty:
cd ~/dotfiles
mkdir -p alacritty/.config
mv ~/.config/alacritty alacritty/.config/
stow -nv -t ~ alacritty
stow -v -t ~ alacrittyAfter Stow creates the symlink, editing either path modifies the same file:
nvim ~/.zshrc
# same as:
nvim ~/dotfiles/zsh/.zshrcThen commit the change:
cd ~/dotfiles
git status
git add zsh/.zshrc
git commit -m "Update zsh config"
git pushIf Stow reports a conflict like this:
cannot stow package over existing target since neither a link nor a directory
It means the target already exists and is not managed by Stow.
Preferred fix:
mv ~/.example ~/.example.bak
stow -nv -t ~ package
stow -v -t ~ packageIf the old file should be kept, move it into the correct package before running Stow:
mkdir -p package
mv ~/.example package/
stow -nv -t ~ package
stow -v -t ~ packageThe helper script also supports adoption for selected packages:
./stow.sh --adopt packageAvoid adoption unless I fully understand what it will move into this repository. Preview the package first with ./stow.sh package.
Never commit plaintext secrets.
Do not put these into this public dotfiles repository:
API tokens
passwords
private keys
~/.ssh/id_*
~/.gnupg/
~/.config/sops/age/keys.txt
plaintext .env files
npm auth tokens
Kubernetes credentials
Docker auth files
Allowed:
secrets/*.sops.env # encrypted by sops
.npmrc # registry and other public config only, no auth token
.gitconfig signingkey # okay if it is a GPG key ID or public SSH key path
Before pushing, scan for obvious leaks:
cd ~/dotfiles
grep -RniE 'npm[_-]?token|_authToken|token|secret|password|passwd|api[_-]?key|apikey|bearer|ghp_|sk-' .Seeing ENC[...] inside *.sops.env is fine. Seeing a real token is not fine.
Use:
sops + age + direnv
sopsencrypts secret files.ageprovides the encryption key pair.direnvloads secrets only inside selected project directories.
Age private key location:
~/.config/sops/age/keys.txt
This file must never be committed.
Create an encrypted env file:
cd ~/dotfiles
mkdir -p secrets
sops secrets/npm.sops.envExample content while editing through sops:
NPM_TOKEN=real_token_hereAfter saving, the file should contain encrypted ENC[...] values.
Use the shell helpers for commands that need an npm token:
npm-auth publish
pnpm-auth publishExample .envrc in a project:
use_sops_env ~/dotfiles/secrets/npm.sops.envThen allow it:
direnv allowWithout package arguments, ./stow.sh previews or applies these maintained packages:
alacritty
btop
desktop
direnv
fcitx5
git
micro
neovide
niri
noctalia
npm
nvim
pnpm
zellij
zsh
The desktop packages (alacritty, btop, desktop, fcitx5, neovide, niri, noctalia, and zellij) are intentionally personal Linux configuration. Apply them only on a machine where their programs and desktop stack are installed. secrets/, documentation, and repository tooling are deliberately excluded from the default Stow set.
Candidates not currently applied by default:
waybar
wofi
wlogout
swaylock
mako
fontconfig
gtk
qt
systemd
environment
Avoid managing caches, login state, browser profiles, package stores, and whole IDE data directories.
# Arch Linux:
sudo pacman -S git stow sops age direnv
# Debian / Ubuntu:
sudo apt update
sudo apt install git stow sops age direnv
# Fedora:
sudo dnf install git stow sops age direnv
git clone https://github.com/YangYuS8/dotfiles.git ~/dotfiles
cd ~/dotfiles
./stow.sh zsh git micro
./stow.sh --apply zsh git microIf encrypted secrets are needed, restore or create:
~/.config/sops/age/keys.txt
Then test:
sops -d secrets/npm.sops.env- Preview with
stow -nbefore applying. - Stow only explicit packages.
- Do not commit plaintext secrets.
- Keep age private keys outside this repository.
- Use
direnvfor project-specific environment variables. - Commit small, understandable changes.