- I use
stow,git,systemd
Stow
stowsimplifies managing configuration files by creating symbolic links.- make a parent directory that will contain all configs
- create subfolders within your
~/dotfilesdirectory, with each subfolder holding the configuration for a specific program (e.g.,~/dotfiles/nvim) Stowcreates symbolic links (shortcuts, essentially) from the files inside that subfolder to where your system or applications expect them to be in your actual home directory.- So, if you have
~/dotfiles/bash/.bashrc, Stow will create a symlink at~/.bashrcthat points back to the original file in your~/dotfilesdirectory. - So,
~/dotfiles/vim/.config/nvim/, will create symlink at~/.config/nvim/
sudo pacman -S stow
mkdir ~/dotfiles
cd ~/dotfiles
mkdir -p vim/.config/nvim/init.lua
stow nvim
ls ~/.config/nvim #confirm that a symlink was generated
Git
- init a
gitrepo and connect it togithub
git init
git remote add origin YOUR_REMOTE_URL
push script
- make a push script using bash
~/dotfiles/push_script.sh
#!/bin/sh
# Assuming your dotfiles repo is at ~/dotfiles
cd $HOME/dotfiles # Or wherever your dotfiles repo is
git add . # Add any new or changed files
git commit -m "Auto-commit dotfiles changes $(date +%Y-%m-%d_%H-%M-%S)" || true # Commit only if changes exist
git push
- Make it executable:
chmod +x push_script.sh
systemd
-
Systemd operates on the principle of “units,” and each unit type (like a service, timer, socket, etc.) has its own dedicated file extension and purpose.
- A
.servicefile describes what to run (e.g., a script, an application). - A
.timerfile describes when to run a corresponding service.
- A
-
Create a service file (
~/.config/systemd/user/dotfiles-push.service)
[Unit]
Description=Push dotfiles to GitHub
[Service]
Type = oneshot
ExecStart=/bin/bash -c "~/dotfiles/push_script.sh"
# Ensure HOME is set correctly for your script
Environment=HOME=%h
- Create a timer file (
~/.config/systemd/user/dotfiles-push.timer)
[Unit]
Description=Run dotfiles push service hourly
[Timer]
OnCalendar=hourly
Persistent=true
# This line links the timer to the service:
Unit=dotfiles-push.service
[Install]
WantedBy=timers.target
- Reload systemd, enable, and start the timer:
systemctl --user daemon-reload
systemctl --user enable dotfiles-push.timer
systemctl --user start dotfiles-push.timer
- check the status
systemctl --user status dotfiles-push.timer
journalctl --user -u dotfiles-push.service