Skip to content

jainsau/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Saurabh's Dotfiles

This repository contains my personal dotfiles, managed with Nix and Home Manager to create a reproducible, declarative, and highly modular development environment. It is tailored for macOS and includes configurations for Zsh, Neovim, and a wide array of command-line tools.


📝 Neovim: adding LSPs and linters

This repo symlinks nix/home-manager/editors/nvim into ~/.config/nvim, so edits to those Lua files apply immediately on the next nvim start (no rebuild needed).

  • Add an LSP server:

    • Edit nix/home-manager/editors/nvim/lua/plugins/mason.lua and add the server to the servers table.
    • Mason will auto-install servers/tools declared via ensure_installed on first launch.
  • Add a linter:

    • Edit nix/home-manager/editors/nvim/lua/plugins/lint.lua and add the linter to linters_by_ft.
    • If the linter is an external CLI (e.g., markdownlint-cli2), install it via Nix by adding it to home.packages in nix/home-manager/default.nix.
  • When do you need to rebuild?

    • Editing Lua config: no rebuild; restart Neovim.
    • Adding external binaries via Nix: run home-manager switch --flake ..
    • Updating to newer package versions: run nix flake update first, then switch.

✨ Features

  • Declarative & Reproducible: Built on Nix and Home Manager, ensuring a consistent setup across machines.
  • Fully Modular: Configurations are broken down into small, single-purpose modules for tools, aliases, and shell settings, making them easy to manage and customize.
  • Modern Shell: A powerful Zsh environment managed natively with Home Manager, featuring Starship for a minimal and fast prompt.
  • Customized Editors: Tailored configurations for Neovim (based on a streamlined Lua setup) and VSCode.
  • Rich Toolset: Includes curated configurations for dozens of popular CLI and development tools like eza, bat, fzf, git, delta, and lazygit.
  • Modular config logic lives in nix/ (parameterized by settings)
  • Pure flake (flake.nix) with user settings imported from nix/user.nix for reproducibility.

📂 Structure

The configuration is built around a flake-based Nix setup. The core logic resides in the nix/ directory:

dotfiles/
├── flake.nix        # Main Nix Flake entrypoint
├── install.sh       # Installation script
├── prompts/         # AI agent prompts and workflows
└── nix/
    ├── user.nix     # User-specific settings
    ├── mkConfig.nix # Configuration generation logic
    ├── systems.nix  # System definitions (Darwin/Home Manager)
    ├── darwin/      # macOS-specific system configurations
    └── home-manager/  # User-level configurations (managed by Home Manager)
        ├── modules/   # The heart of the setup:
        │   ├── cli/       # CLI tools (e.g., eza, fzf, git, delta, lazygit)
        │   ├── dev/       # Development tools (e.g., direnv, language tools)
        │   ├── shell/     # Zsh, Tmux, and other shell settings
        │   └── system-tools.nix  # System monitoring tools (e.g., podman, nmap)
        └── default.nix  # Aggregates all Home Manager configurations

🚀 Installation & Usage

  1. Clone the Repository:
    git clone https://github.com/your-username/dotfiles.git ~/.dotfiles
    cd ~/.dotfiles
  2. Run the Installation Script: This will install Nix and set up your environment.
    ./install.sh
  3. Edit User Settings: If needed, edit your user-specific settings in nix/user.nix.
  4. Apply Changes: After editing your configuration, apply the changes with:
    • nix run .#hma-switch (for Home Manager)
    • nix run .#dma-switch (for Darwin)

🔄 Updating packages

This repo uses flakes. Switching uses the versions pinned in flake.lock.

  • To switch with current pins:

    • Darwin: darwin-rebuild switch --flake .
    • Home Manager: home-manager switch --flake .
  • To update to newer package versions:

    • All inputs: nix flake update
    • Specific input (e.g., nixpkgs): nix flake update --update-input nixpkgs
    • Then run the switch command again.

🔧 User Settings

User-specific settings (such as username, home directory, git identity) are defined in nix/user.nix. Edit this file to personalize your setup:

{
  username = "your_username";
  homeDirectory = "/Users/your_username";
  gitUser = "Your Name";
  gitEmail = "your.email@example.com";
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published