Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
brew 'stow'
brew 'git-delta'
brew 'herdr'
cask 'wezterm'
Expand Down
102 changes: 26 additions & 76 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,84 +1,40 @@
.DEFAULT_GOAL := help

STOW_PACKAGES ?= bash fastfetch git herdr lazygit nvim wezterm yazi zsh

.PHONY: help
help:
@echo "Dotfiles Setup Commands:"
@echo ""
@echo "Initial Setup:"
@echo " make install-nix - Install Nix package manager"
@echo " make setup-home-manager - Bootstrap home-manager (first time setup)"
@echo " make setup-mac - Full setup for macOS (Nix + home-manager + Homebrew)"
@echo " make setup-linux - Full setup for Linux (Nix + home-manager)"
@echo " make setup-wsl-nixos - Link NixOS configuration for WSL2 (requires sudo)"
@echo " make setup-mac - Install Brewfile packages and Stow dotfiles + AeroSpace"
@echo " make setup-arch - Install pacman list and Stow dotfiles"
@echo " make stow - Symlink STOW_PACKAGES into your home directory"
@echo " make setup-wsl-nixos - Stage NixOS WSL2 from an existing checkout (sudo)"
@echo ""
@echo "NixOS WSL2 Commands:"
@echo " make switch - Rebuild NixOS system (slow, needs sudo)"
@echo " make home-switch - Rebuild home-manager only (fast, no sudo)"
@echo " make build - Build system without switching (test config)"
@echo " make update - Update flake inputs"
@echo " make upgrade - Update flake inputs and rebuild"
@echo " make generations - List system generations"
@echo " make home-generations - List home-manager generations"
@echo " make gc - Run garbage collection"
@echo " make clean - Deep clean (delete old generations + gc)"
@echo ""
@echo "Other Commands:"
@echo " make set-default-shell - Set zsh as default shell (requires sudo)"
@echo " make install-brew - Install Homebrew (macOS only)"
@echo " make install-brew-packages- Install GUI apps via Homebrew (macOS only)"
@echo " make install-brew-packages - Install packages from Brewfile (macOS only)"
@echo " make install-arch-packages - Upgrade Arch and install pacman-packages.txt"
@echo ""

.PHONY: install-nix
install-nix:
@echo "Installing Nix package manager..."
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

.PHONY: setup-home-manager
setup-home-manager:
@echo "Activating home-manager configuration..."
@echo "Detecting system..."
@if [ "$$(uname -s)" = "Darwin" ]; then \
if [ "$$(uname -m)" = "arm64" ]; then \
echo "Detected: macOS Apple Silicon"; \
nix run nix-darwin -- switch --flake .#aarch64; \
else \
echo "Detected: macOS Intel"; \
nix run nix-darwin -- switch --flake .#x86_64; \
fi \
else \
if [ "$$(uname -m)" = "x86_64" ]; then \
echo "Detected: Linux x86_64"; \
nix run home-manager/master -- switch --flake .#$$USER-x86_64-linux; \
else \
echo "Detected: Linux ARM64"; \
nix run home-manager/master -- switch --flake .#$$USER-aarch64-linux; \
fi \
fi

.PHONY: update-home-manager
update-home-manager:
@echo "Updating home-manager configuration..."
@if [ "$$(uname -s)" = "Darwin" ]; then \
if [ "$$(uname -m)" = "arm64" ]; then \
darwin-rebuild switch --flake .#aarch64; \
else \
darwin-rebuild switch --flake .#x86_64; \
fi \
else \
if [ "$$(uname -m)" = "x86_64" ]; then \
nix run home-manager/master -- switch --flake .#$$USER-x86_64-linux; \
else \
nix run home-manager/master -- switch --flake .#$$USER-aarch64-linux; \
fi \
fi

.PHONY: set-default-shell
set-default-shell:
@echo "Setting zsh as default shell..."
@echo "This requires sudo access to modify /etc/shells"
@ZSH_PATH=$$(which zsh); \
if [ -z "$$ZSH_PATH" ]; then \
echo "Error: zsh not found. Run 'make setup-home-manager' first."; \
echo "Error: zsh not found. Install it with your OS package manager first."; \
exit 1; \
fi; \
echo "Found zsh at: $$ZSH_PATH"; \
Expand All @@ -102,19 +58,26 @@ install-brew:
.PHONY: install-brew-packages
install-brew-packages:
@echo "Installing Homebrew packages..."
brew bundle
brew bundle --file=Brewfile

.PHONY: install-arch-packages
install-arch-packages:
@echo "Upgrading Arch Linux and installing packages..."
sudo pacman -Syu --needed - < pacman-packages.txt

.PHONY: stow
stow:
stow --dir="$(CURDIR)" --target="$(HOME)" $(STOW_PACKAGES)

.PHONY: setup-mac
setup-mac: install-nix setup-home-manager install-brew install-brew-packages
@echo ""
@echo "✅ macOS setup complete!"
@echo "Packages installed via Nix, GUI apps installed via Homebrew"
setup-mac: install-brew-packages
$(MAKE) stow STOW_PACKAGES="$(STOW_PACKAGES) aerospace"
@echo "Brewfile packages installed and macOS dotfiles linked."

.PHONY: setup-linux
setup-linux: install-nix setup-home-manager
@echo ""
@echo "✅ Linux setup complete!"
@echo "All packages and configs installed via Nix"
.PHONY: setup-arch
setup-arch: install-arch-packages
$(MAKE) stow
@echo "Pacman packages installed and Arch Linux dotfiles linked."

.PHONY: setup-wsl-nixos
setup-wsl-nixos:
Expand Down Expand Up @@ -142,11 +105,6 @@ switch:
@echo "Rebuilding NixOS system..."
sudo nixos-rebuild switch --flake .#nixos-wsl

.PHONY: home-switch
home-switch:
@echo "Rebuilding home-manager configuration..."
nix run home-manager/master -- switch --flake .#nixos-wsl

.PHONY: build
build:
@echo "Building NixOS system (without switching)..."
Expand All @@ -166,11 +124,6 @@ generations:
@echo "System generations:"
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system

.PHONY: home-generations
home-generations:
@echo "Home-manager generations:"
nix run home-manager/master -- generations

.PHONY: gc
gc:
@echo "Running garbage collection..."
Expand All @@ -182,7 +135,4 @@ clean:
@echo "Deep cleaning old generations and running garbage collection..."
@echo "Deleting system generations older than 7 days..."
sudo nix-collect-garbage --delete-older-than 7d
@echo "Deleting home-manager generations older than 7 days..."
nix run home-manager/master -- expire-generations "-7 days"
@echo "✅ Deep clean complete!"

50 changes: 43 additions & 7 deletions README
Original file line number Diff line number Diff line change
@@ -1,12 +1,48 @@
Fully Reproducible dotfiles config
Dotfiles
========

"Dotfiles managed by Nix: because spending 40 hours to save 4 minutes is a lifestyle. Fully reproducible - I've tested it on my Windows gaming rig (NixOS-WSL2), my wife's MacBook Air, and my own laptop (I use Arch BTW). If it works there, it'll work anywhere."
Shared application configuration with platform-specific package management:

Follows the XDG Base Directory Specification - keeping your home directory clean and uncluttered by organizing all configuration files in ~/.config instead of scattering dotfiles everywhere.
NixOS WSL2 / native NixOS Nix flakes + integrated Home Manager
macOS Homebrew Bundle (Brewfile) + GNU Stow
Arch Linux pacman (pacman-packages.txt) + GNU Stow

For Nix setup and usage, see docs/README.nix.md.
Nix is only used for NixOS. There are no macOS or standalone Linux Home
Manager configurations. The native package lists are smaller than the NixOS
development environment; they do not install every configured application.

FAQ
Most application configs live under .config in Stow-compatible directories.
Zsh and Bash startup files live directly in the home directory. Symlinks keep
the checkout editable; application config changes take effect after reloading
the application, without a Nix rebuild.

Q: Why Nix?
A: Because I like pain and reproducibility.
Getting started
---------------

Read docs/DEPLOYMENT.md first for prerequisites, shell dependencies, existing
file conflicts, and native NixOS hardware customization.

From a checkout at ~/dotfiles:

macOS: make setup-mac (requires Homebrew on PATH)
Arch Linux: make setup-arch (requires sudo and pacman)

For a fresh, already installed NixOS-WSL distribution:

nix --extra-experimental-features 'nix-command flakes' run github:user3301/dotfiles#bootstrap-wsl

For ongoing NixOS WSL updates: make switch
For native NixOS: sudo nixos-rebuild switch --flake .#nixos-native
Both NixOS configurations use /home/user3301/dotfiles.

Documentation
-------------

docs/DEPLOYMENT.md Installation, migration, and local settings
docs/QUICK_REFERENCE.md Common commands
docs/ARCHITECTURE.md Source layout, modules, and CI
docs/README.nix.md NixOS usage and maintenance
docs/EXAMPLE-VERSION-PINNING.md The Nix package pins used by this repo
docs/IMPLEMENTATION_SUMMARY.md Current platform support and boundaries
git/.config/git/README.md Git identity and SSH commit signing
nvim/.config/nvim/README.md LazyVim and language-server setup
Loading
Loading