Modular dotfiles managed with Home Manager and Nix Flakes for reproducible development environments.
- π Modular Architecture - Clean separation of concerns with focused modules
- π§ Modern CLI Tools - Replaces traditional tools with faster, more intuitive alternatives
- π Multi-Shell Support - Elvish (primary), Zsh, and Bash with shared configurations
- π» Development Ready - Complete toolchains for multiple languages and frameworks
- πͺ WSL Optimized - Automatic detection and optimization for Windows Subsystem for Linux
- π¦ Reproducible - Nix ensures identical environments across machines
- Linux or WSL2
- Git
- Internet connection
# Clone the repository
git clone https://github.com/naroslife/dotfiles.git ~/dotfiles
cd ~/dotfiles
# Run the setup script (installs Nix if needed)
./apply.shThe setup script will:
- Install Nix with flakes support (if not already installed)
- Detect your username and apply the appropriate configuration
- Set up all shells, tools, and configurations
- Configure locale (using C.UTF-8 for WSL compatibility)
If you prefer manual control:
# Install Nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
# Enable flakes
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
# Apply configuration
nix run home-manager/master -- switch --impure --flake .#$USERdotfiles/
βββ flake.nix # Nix flake definition with user configurations
βββ home.nix # Main home-manager entry point (minimal)
βββ apply.sh # Interactive setup script
β
βββ modules/ # Modular Nix configurations
β βββ default.nix # Module aggregator
β βββ core.nix # Essential packages and utilities
β βββ environment.nix # Environment variables and locale
β βββ wsl.nix # WSL-specific configuration
β βββ shells/ # Shell configurations (bash, zsh, aliases)
β β βββ default.nix # Starship, Atuin, shared tools
β β βββ bash.nix
β β βββ zsh.nix
β β βββ aliases.nix
β βββ dev/ # Development tools
β β βββ default.nix # Tmux, Neovim, editors
β β βββ git.nix # Git with delta and hooks
β β βββ ssh.nix # SSH with security hardening
β β βββ vscode.nix # VS Code with extensions
β β βββ languages.nix # Programming languages
β β βββ containers.nix # Docker, Kubernetes
β βββ cli/ # CLI tools
β βββ default.nix
β βββ modern.nix # Modern replacements (eza, bat, fd, rg)
β βββ productivity.nix # Productivity tools (fzf, ranger, jq)
β
βββ scripts/ # Shell scripts
β βββ apt-network-switch.sh # WSL network detection
β
βββ wsl-init.sh # WSL initialization (sources once per shell)
β
βββ tmux/ # Tmux configuration
β βββ scripts/ # Tmux helper scripts
β
βββ elvish/ # Elvish shell configuration
βββ rc.elv
βββ lib/
βββ aliases/
- Primary Shell: Elvish - Friendly interactive shell with structured data
- Secondary Shells: Zsh with syntax highlighting, Bash with smart completions
- Prompt: Starship - Fast, customizable, minimal prompt
- History: Atuin - Sync, search, and backup shell history
- Completions: Carapace - Multi-shell completion framework
| Traditional | Modern Alternative | Description |
|---|---|---|
ls |
eza | Better listing with git integration |
cat |
bat | Syntax highlighting and git integration |
find |
fd | User-friendly and fast file finder |
grep |
ripgrep | Blazingly fast recursive search |
sed |
sd | Intuitive find and replace |
du |
dust | Intuitive disk usage visualizer |
df |
duf | Better disk usage display |
ps |
procs | Modern process viewer |
top |
bottom | Graphical process monitor |
cd |
zoxide | Smarter cd that learns your habits |
- Java: JDK 17, Maven, Gradle
- C/C++: GCC, CMake, Ninja, Meson
- Python: Python 3.12 with pip
- Ruby: Ruby 3.3 with bundler
- Go: Latest Go compiler
- Rust: Cargo and rustc
- Node.js: Node 20 with npm, yarn, pnpm
- Docker & docker-compose
- lazydocker - Docker terminal UI
- kubectl & k9s - Kubernetes management
- Helm - Kubernetes package manager
- fzf - Fuzzy finder
- ranger - Terminal file manager
- broot - Interactive tree explorer
- tmux - Terminal multiplexer
- jq - JSON processor
- yq - YAML processor
Users are defined in flake.nix:
users = {
username = {
email = "user@example.com";
fullName = "Full Name";
};
};Create a new module in modules/ and import it in modules/default.nix:
# modules/my-module.nix
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
# your packages
];
}The configuration automatically detects WSL and:
- Configures clipboard integration (pbcopy/pbpaste)
- Sets up APT repository switching for corporate networks
- Optimizes performance settings
- Provides Windows interop commands
- Shows helpful reminders once per day (not on every shell)
# Update all flake inputs
nix flake update
# Update specific input
nix flake update nixpkgsAfter modifying configuration files:
./apply.sh
# or
home-manager switch --flake .#$USER# List generations
home-manager generations
# Remove old generations
home-manager expire-generations "-30 days"-
Nix command not found
- Restart your shell or source the Nix profile:
. ~/.nix-profile/etc/profile.d/nix.sh
-
Flake evaluation errors
- Check syntax:
nix flake check - Ensure all imports exist and are valid
- Check syntax:
-
Locale warnings
- The config uses
C.UTF-8which is available on all systems - If you need
en_US.UTF-8, install locale package and updatemodules/environment.nix
- The config uses
-
WSL-specific issues
- Run
./scripts/apt-network-switch.shto fix APT repositories - Ensure WSL2 is being used (not WSL1)
- Run
-
Permission denied
- Home Manager doesn't require sudo
- Ensure you own your home directory
Feel free to fork and customize for your own use! Key principles:
- Keep modules focused and under 200 lines
- Extract complex scripts to
scripts/directory - Document any new modules or significant changes
- Test changes with
nix flake checkbefore committing
MIT - See LICENSE file for details
- Nix and Home Manager communities
- Authors of all the amazing CLI tools included
- NUR - Nix User Repository