Nix-based dotfiles configuration using Home Manager and nix-darwin for macOS system management.
Install the Nix package manager with flakes support:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installAfter installation, restart your terminal or source the environment:
source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shIf not already enabled, add flake support to /etc/nix/nix.custom.conf:
experimental-features = nix-command flakes
Since Home Manager will manage Git, install it temporarily to clone the repository. This will only install git for the current shell. Once exited, git will no longer be in your PATH.
nix-shell -p gitgit clone https://github.com/yourusername/dotfiles.git
cd dotfiles# Apply Home Manager configuration
nix run .#homeConfigurations.jonerickson.activationPackage# Make sure command line tools have been installed first
xcode-select --install
nix build .#darwinConfigurations.jonerickson.system
sudo ./result/sw/bin/darwin-rebuild activateImportant: Make sure all changes are committed before building: git add -A && git commit -m "Initial setup"
If you need to manage secrets, follow these steps:
- Generate a new age encryption key:
mkdir -p ~/.config/sops/ageage-keygen > ~/.config/sops/age/keys.txt- Get your public key and update configuration:
age-keygen -y ~/.config/sops/age/keys.txt-
Update
.sops.yamlwith your new public key (replace the existing key) -
Create and encrypt your secrets file:
# Create unencrypted secrets file
cp home/secrets.yaml.example home/secrets.yaml # if example exists
# OR manually create home/secrets.yaml with your secrets
# Encrypt the file
sops -e -i home/secrets.yaml
# Commit the encrypted file
git add home/secrets.yaml .sops.yaml
git commit -m "Add encrypted secrets" - Copy your existing age key from your old machine:
mkdir -p ~/.config/sops/age
# Copy your existing keys.txt file to ~/.config/sops/age/keys.txt-
The existing
.sops.yamland encryptedhome/secrets.yamlshould already work with your key -
Test decryption:
sops -d home/secrets.yamlThe home/secrets.yaml file should contain:
composer:
whizzy-username: your-username
whizzy-password: your-password
filament-username: your-username
filament-password: your-password
spark-username: your-username
spark-password: your-password
github-token: your-github-token Note: Do not commit an unencrypted version home/secrets.yaml to your VCS. You should only commit the encrypted version of your secrets.
After making changes to the user configuration:
git add -A
git commit -m "Update user configuration"
nix run .#homeConfigurations.jonerickson.activationPackageAfter making changes to the system configuration:
git add -A
git commit -m "Update system configuration"
nix build .#darwinConfigurations.jonerickson.system
sudo ./result/sw/bin/darwin-rebuild activateTo update encrypted secrets:
# Edit secrets (will decrypt, open editor, then re-encrypt)
sops home/secrets.yaml
# Or manually decrypt, edit, and re-encrypt
sops -d home/secrets.yaml > temp_secrets.yaml
# Edit temp_secrets.yaml
sops -e -i temp_secrets.yaml
mv temp_secrets.yaml home/secrets.yaml
# Commit changes
git add home/secrets.yaml
git commit -m "Update secrets" - PHP: PHP 8.4, Composer with Laravel, Pest, PHPStan, PHP CS Fixer
- Node.js: Node.js 22, npm, yarn, pnpm, Bun with global packages (ESLint, Prettier, TypeScript, Vite, etc.)
- Python: Python 3, pyenv, poetry, pip, pipx, virtualenv, black, flake8, pytest
- Ruby: Ruby 3.3, CocoaPods
- Databases: MySQL 8.0, PostgreSQL 15, Redis, SQLite
- GUI Tools: DBeaver
- IDEs: PhpStorm (via Homebrew), nano, vim
- Editor Configs: EditorConfig, PHP CS Fixer, Pylint configuration
- Containers: Docker, Docker Compose
- Build Tools: GNU Make, CMake, pkg-config
- Version Control: Git with LFS, GitHub CLI, git-filter-repo
- Web Tools: curl, wget, HTTPie, Postman, mkcert, ngrok, chromedriver
- Search & Navigation: ripgrep, fd, fzf, bat, tree
- System: htop, jq, yq
- Archives: unzip, p7zip
- Media: ImageMagick, FFmpeg
- Network: OpenSSH, rsync
- Shell: Zsh with Oh My Zsh, syntax highlighting, autosuggestions
- Themes & Plugins: Robbyrussell theme, Git, Brew, macOS, Docker, npm, Composer, Laravel plugins
- Package Management: Nix with flakes support, nixfmt for code formatting
- Productivity: 1Password, Raycast, Slack, Discord
- Development: Docker, Google Chrome, Sublime Text
- Terminal: Ghostty
nix flake updatenix flake checknixfmt ./**/*.nixflake.nix- Main configuration with inputs and outputshome/- Home Manager user configurationsmodules/- System-level modulesmodules/darwin- System-level modules specific for darwin OS