Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

193 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dotfiles

Modular dotfiles managed with Home Manager and Nix Flakes for reproducible development environments.

Features

  • πŸš€ 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

Quick Start

Prerequisites

  • Linux or WSL2
  • Git
  • Internet connection

Installation

# Clone the repository
git clone https://github.com/naroslife/dotfiles.git ~/dotfiles
cd ~/dotfiles

# Run the setup script (installs Nix if needed)
./apply.sh

The setup script will:

  1. Install Nix with flakes support (if not already installed)
  2. Detect your username and apply the appropriate configuration
  3. Set up all shells, tools, and configurations
  4. Configure locale (using C.UTF-8 for WSL compatibility)

Manual Installation

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 .#$USER

Project Structure

dotfiles/
β”œβ”€β”€ 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/

Included Tools

Shell Environment

  • 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

Modern CLI Replacements

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

Development Tools

Version Control

  • Git with delta diff viewer
  • lazygit - Terminal UI for git
  • gh - GitHub CLI

Languages & Frameworks

  • 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

Container & Cloud

  • Docker & docker-compose
  • lazydocker - Docker terminal UI
  • kubectl & k9s - Kubernetes management
  • Helm - Kubernetes package manager

Text Editors

  • Neovim - Hyperextensible Vim-based editor
  • Helix - Post-modern modal editor

Productivity Tools

  • fzf - Fuzzy finder
  • ranger - Terminal file manager
  • broot - Interactive tree explorer
  • tmux - Terminal multiplexer
  • jq - JSON processor
  • yq - YAML processor

Configuration

User Management

Users are defined in flake.nix:

users = {
  username = {
    email = "user@example.com";
    fullName = "Full Name";
  };
};

Adding New Modules

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
  ];
}

WSL Integration

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)

Maintenance

Update Dependencies

# Update all flake inputs
nix flake update

# Update specific input
nix flake update nixpkgs

Apply Changes

After modifying configuration files:

./apply.sh
# or
home-manager switch --flake .#$USER

Clean Old Generations

# List generations
home-manager generations

# Remove old generations
home-manager expire-generations "-30 days"

Troubleshooting

Common Issues

  1. Nix command not found

    • Restart your shell or source the Nix profile:
    . ~/.nix-profile/etc/profile.d/nix.sh
  2. Flake evaluation errors

    • Check syntax: nix flake check
    • Ensure all imports exist and are valid
  3. Locale warnings

    • The config uses C.UTF-8 which is available on all systems
    • If you need en_US.UTF-8, install locale package and update modules/environment.nix
  4. WSL-specific issues

    • Run ./scripts/apt-network-switch.sh to fix APT repositories
    • Ensure WSL2 is being used (not WSL1)
  5. Permission denied

    • Home Manager doesn't require sudo
    • Ensure you own your home directory

Contributing

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 check before committing

License

MIT - See LICENSE file for details

Acknowledgments

  • Nix and Home Manager communities
  • Authors of all the amazing CLI tools included
  • NUR - Nix User Repository

About

My dotfiles synced from localhost and remote machines

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages