| bin | ||
| go | ||
| home-manager | ||
| scripts | ||
| shell | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| macos.nix | ||
| README.md | ||
Elliot's dot files
A Nix-centric dotfiles configuration that manages system packages and core configurations declaratively, while maintaining flexibility for custom shell functions and scripts.
Structure
The dotfiles are organized around Nix as the primary configuration system, with custom shell scripts for flexibility:
- nix/: Core system and application configuration using Nix and home-manager
- shell/: Custom shell functions and completions that extend the base configuration
- bin/: Executable scripts available in PATH
Core Philosophy
This setup uses Nix where it excels (declarative package and configuration management) while keeping shell functions and scripts flexible for rapid iteration and customization.
What's Inside
Nix Configuration
- nix/flake.nix: Main flake configuration for macOS and Linux
- nix/home-manager/: Home Manager configurations for user programs
- nix/home-manager/programs/: Individual program configurations (git, zsh, tmux)
Shell Extensions
- shell/functions/: Custom shell functions (git helpers, prompt, window management)
- shell/completions/: Custom zsh completions
- bin/: Utility scripts and git helpers
How It Works
Nix Management
Nix handles:
- Package installation and management
- Core program configuration (git, zsh, tmux, etc.)
- Environment variables and shell aliases
- System-level settings
Shell Function Loading
The zsh configuration automatically loads:
- All
*.zshfiles fromshell/functions/as shell functions - All
*.zshfiles fromshell/completions/as completions (after compinit) - Scripts from
bin/are automatically added to$PATH
Adding New Functionality
- Declarative config: Add to appropriate
nix/home-manager/programs/*.nixfile - Shell functions: Create new
.zshfiles inshell/functions/ - Completions: Add completion scripts to
shell/completions/ - Executables: Add scripts to
bin/
Installation
Prerequisites
- Install Nix. The recommended path is via the Determinate Systems project "nix installer", although this will soon drop standard nix. There is a fork in the works but it's experimental.
Determinate Systems version - https://github.com/DeterminateSystems/nix-installer Nix fork (experimental) - https://github.com/NixOS/experimental-nix-installer
- On macOS, install nix-darwin via the
nix runcommand in the nix-darwin installation guide. This will require the dotfiles to be pulled, and you to be in thenixdirectory.
Setup
# For macos personal machine
sudo darwin-rebuild build --flake .#elliot@macos-personal
sudo darwin-rebuild switch --flake .#elliot@macos-personal
# For macos work machine
sudo darwin-rebuild build --flake .#elliot@macos-work
sudo darwin-rebuild switch --flake .#elliot@macos-work
# On Linux:
home-manager switch --flake .#elliot@hostname
Customization
- Edit program configurations in
nix/home-manager/programs/ - Add shell functions to
shell/functions/ - Modify the flake.nix for system-level changes
- Use
~/.localrcand~/.localaliasesfor machine-specific overrides
Garbage collection
Nix maintains built profiles pretty much infinitely from what I can tell. So it's useful to clean up every so often to keep disk usage under control.
# Delete all but the 5 most recent profile generations.
# This works on macos, it might work on linux as well.
sudo nix-env --delete-generations +5 --profile /nix/var/nix/profiles/system
Notes
- asdf is accounted for via shims and functions in the zsh/bash scripts, but it's not encouraged. Most systems managed by these dotfiles don't use them but it's there to support other systems.