Skip to content

hyb175/dotfiles

Repository files navigation

Dotfiles

Multi-platform development environment using Nix (NixOS, macOS via nix-darwin, WSL via home-manager).

Features

  • Fish shell with custom AI functions and starship prompt
  • Tmux with everforest theme, session persistence, and sesh integration
  • Neovim with LazyVim (50+ plugins, AI integrations)
  • asdf for language version management (.tool-versions support)
  • Cross-platform: Same configs on NixOS, macOS, and WSL
  • Declarative: Entire system configuration in version control
  • Reproducible: Identical setup across all machines

Prerequisites

Install Nix (All Platforms)

# Install Nix with flakes support
sh <(curl -L https://nixos.org/nix/install) --daemon

# Enable flakes
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf

Installation

NixOS (Linux)

cd ~/Projects/dotfiles

# Generate hardware config (if new machine)
sudo nixos-generate-config --show-hardware-config > nixos/hardware-configuration.nix

# Stage files in git (required for flakes)
git add flake.nix nixos darwin home-manager

# Apply configuration
sudo nixos-rebuild switch --flake .#nixos

macOS (nix-darwin)

cd ~/Projects/dotfiles

# Stage files in git
git add flake.nix darwin home-manager

# First time: Install nix-darwin
nix run nix-darwin -- switch --flake .#macos-hostname

# Subsequent updates
darwin-rebuild switch --flake .#macos-hostname

# Install GUI apps via Homebrew
brew bundle --file=homebrew/Brewfile

WSL (home-manager standalone)

cd ~/Projects/dotfiles

# Stage files in git
git add flake.nix home-manager

# First time
nix run home-manager/master -- switch --flake .#hyb175@wsl-hostname

# Subsequent updates
home-manager switch --flake .#hyb175@wsl-hostname

Updating

Update Flake Dependencies

cd ~/Projects/dotfiles
nix flake update  # Updates flake.lock

Apply Updates

  • NixOS: sudo nixos-rebuild switch --flake .#nixos
  • macOS: darwin-rebuild switch --flake .#macos-hostname
  • WSL: home-manager switch --flake .#hyb175@wsl-hostname

Update Neovim Plugins

nvim -c "Lazy update"

Update asdf Language Versions

# In project directory with .tool-versions
asdf install

# Or install specific version
asdf install ruby 3.2.0

Post-Install Setup

Configure Git

Edit home-manager/modules/git.nix with your name and email:

userName = "Your Name";
userEmail = "your.email@example.com";

Then rebuild:

  • NixOS: sudo nixos-rebuild switch --flake .#nixos
  • macOS: darwin-rebuild switch --flake .#macos-hostname
  • WSL: home-manager switch --flake .#hyb175@wsl-hostname

Setup asdf Language Plugins

# Install language plugins
asdf plugin add nodejs
asdf plugin add ruby
asdf plugin add python

# In project directory, install versions from .tool-versions
asdf install

Start Docker (if using Colima)

# All platforms
colima start --cpu 4 --memory 8

# Verify
docker ps

Setup Secrets

Create ~/.config/fish/secrets.fish for sensitive environment variables:

#!/usr/bin/env fish
# API keys and secrets (not version controlled)

set -gx OPENAI_API_KEY "your-key-here"
set -gx ANTHROPIC_API_KEY "your-key-here"
set -gx GITHUB_TOKEN "your-token-here"
chmod 600 ~/.config/fish/secrets.fish

Configuration Structure

dotfiles/
├── flake.nix                    # Multi-platform Nix configuration
├── flake.lock                   # Locked dependencies
├── nixos/                       # NixOS system configuration
│   ├── configuration.nix
│   ├── hardware-configuration.nix
│   └── modules/
│       ├── services.nix         # PostgreSQL, Redis, Docker, etc.
│       ├── users.nix
│       └── system-packages.nix
├── darwin/                      # macOS system configuration (nix-darwin)
│   ├── configuration.nix
│   └── modules/
│       ├── homebrew.nix         # GUI apps only
│       ├── system-packages.nix
│       └── preferences.nix
├── home-manager/                # User environment (shared across all platforms)
│   ├── home.nix
│   └── modules/
│       ├── fish.nix
│       ├── tmux.nix
│       ├── neovim.nix
│       ├── git.nix
│       ├── starship.nix
│       └── development.nix      # asdf, direnv
├── nvim/                        # Neovim config (managed by lazy.nvim)
│   ├── init.lua
│   ├── lazy-lock.json
│   └── lua/
├── fish/                        # Fish functions and configs
│   ├── functions/
│   └── conf.d/
├── tmux/                        # Tmux scripts
│   └── scripts/
├── starship.toml               # Starship prompt config
└── homebrew/
    └── Brewfile                 # Minimal - macOS GUI apps only

Key Bindings

Tmux

  • Prefix: Ctrl-a
  • prefix + |: Split horizontally
  • prefix + -: Split vertically
  • prefix + o: Open session switcher (sesh)
  • prefix + r: Reload config
  • prefix + h/j/k/l: Navigate panes (vim-style)
  • prefix + H/J/K/L: Resize panes

Fish Shell

  • fd in insert mode: Escape (in Neovim)
  • Custom aliases: lg (lazygit), ll (eza -l), ta (tmux attach)

Platform-Specific Notes

NixOS

  • Services (PostgreSQL, Redis, Docker) are managed declaratively via nixos/modules/services.nix
  • Start automatically on boot
  • Check status: systemctl status postgresql

macOS

  • Docker: Use Colima (from Nix) or Docker Desktop (from Homebrew)
  • GUI apps: Managed via Homebrew in homebrew/Brewfile
  • System preferences: Managed in darwin/configuration.nix

WSL

  • Use Colima for Docker or Docker Desktop for Windows
  • Clipboard: wl-clipboard and xclip are installed

Maintenance Commands

Garbage Collection

# NixOS
sudo nix-collect-garbage -d

# macOS/WSL
nix-collect-garbage -d

Rollback

# NixOS
sudo nixos-rebuild switch --rollback

# macOS
darwin-rebuild switch --rollback

# WSL (home-manager)
home-manager generations
home-manager switch --flake .#hyb175@wsl-hostname --switch-generation <number>

Check Disk Usage

du -sh /nix/store

Troubleshooting

"Path not tracked by Git" Error

Flakes require files to be tracked by git:

git add flake.nix nixos darwin home-manager

Package Not Found

Search nixpkgs:

nix search nixpkgs <package-name>

Service Won't Start (NixOS)

Check logs:

journalctl -u postgresql -f
systemctl status postgresql

asdf Plugin Issues

# Update asdf plugin repositories
asdf plugin update --all

# Reinstall plugin
asdf plugin remove ruby
asdf plugin add ruby

Migration from Homebrew

If migrating from the old Homebrew-based setup:

  1. Your existing configs (nvim/, fish/, tmux/) are preserved and symlinked
  2. Lazy.nvim continues to manage Neovim plugins - no changes needed
  3. asdf replaces rbenv - same .tool-versions files work
  4. On macOS, Homebrew remains for GUI apps only

License

MIT

Credits

  • LazyVim for the excellent Neovim configuration framework
  • nix-darwin for macOS Nix integration
  • home-manager for declarative dotfiles management

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published