A modular, flake-based NixOS and Home Manager configuration supporting multiple system profiles (WSL, laptop, desktop). This repository provides a comprehensive development environment with extensive CLI tools, Neovim configuration, and optional desktop environments.
- Modular Architecture: Feature flags for granular control over enabled components
- Multiple Profiles: Pre-configured setups for WSL, laptop, and desktop systems
- Declarative Neovim: Complete Neovim configuration using nixvim with LSP, completion, and extensive plugin ecosystem
- Desktop Environments: Support for Hyprland (Wayland) and GNOME
- Development Tools: Integrated support for multiple programming languages and development workflows
- Consistent Theming: Catppuccin theme across all applications
- WSL Integration: First-class support for Windows Subsystem for Linux
- NixOS: Version 23.11 or later (for NixOS installations)
- Nix: With flakes enabled (for non-NixOS installations)
- Git: For cloning the repository
This setup is based on nixos-wsl-starter.
-
Download NixOS-WSL
Get the latest release from NixOS-WSL
-
Import into WSL
wsl --import NixOS .\NixOS\ .\nixos-wsl.tar.gz --version 2
-
Enter the distribution
wsl -d NixOS -
Set up Nix channels
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos sudo nix-channel --update
-
Clone and apply configuration
nix-shell -p git --run "git clone https://github.com/lemonilemon/nixos-config.git /tmp/configuration && \ sudo nixos-rebuild switch --flake /tmp/configuration#NixOS-wsl"
-
Restart WSL
wsl -t NixOS wsl -d NixOS
-
Move configuration to home directory
mv /tmp/configuration ~/nixos-config
For laptop or desktop installations:
-
Clone the repository
git clone https://github.com/lemonilemon/nixos-config.git /etc/nixos cd /etc/nixos -
Copy and modify hardware configuration
# Generate hardware configuration nixos-generate-config --show-hardware-config > profiles/<your-profile>/hardware-configuration.nix
-
Apply configuration
sudo nixos-rebuild switch --flake .#<profile>Available profiles:
laptop,desktop
For using Home Manager on non-NixOS distributions:
-
Install prerequisite packages
# Debian/Ubuntu sudo apt update sudo apt install curl xz-utils git -
Install Nix (single-user)
sh <(curl -L https://nixos.org/nix/install) --no-daemon . ~/.nix-profile/etc/profile.d/nix.sh
-
Enable flakes
mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
-
Clone and apply configuration
git clone https://github.com/lemonilemon/nixos-config.git ~/.config/home-manager cd ~/.config/home-manager nix run home-manager/master switch
-
Configure shell
echo $(which zsh) | sudo tee -a /etc/shells chsh -s $(which zsh) $USER sudo locale-gen # If locale not configured
-
Restart shell or WSL
# For WSL wsl -t <DistroName> wsl -d <DistroName> # For native Linux exec zsh
.
├── flake.nix # Main flake configuration and system definitions
├── flake.lock # Locked flake dependencies
├── Justfile # Command runner recipes for common tasks
├── CLAUDE.md # AI assistant guidance for this repository
├── lib/ # Helper functions and builders
├── modules/ # Modular configuration components
│ ├── cli/ # CLI tools and terminal configuration
│ ├── desktop/ # Desktop environment modules
│ ├── general/ # General system settings
│ ├── gui/ # GUI applications
│ └── home.nix # Home Manager entry point
├── profiles/ # Machine-specific configurations
│ ├── wsl/ # WSL profile
│ ├── laptop/ # Laptop profile
│ └── desktop/ # Desktop profile
├── overlays/ # Package overlays and custom packages
└── nixpkgs/ # Nixpkgs configuration
This repository uses just as a command runner for common operations.
# List all available commands
just
# Update all flake inputs
just update
# Update specific input
just updatep nixpkgs
# Format all Nix files
just fmt
# Build and switch to new configuration
just build
# Dry-build to preview changes
just dry-build
# View system generations
just history
# Test configuration for errors
just test# For WSL
sudo nixos-rebuild switch --flake .#NixOS-wsl
# For laptop
sudo nixos-rebuild switch --flake .#laptop
# For desktop
sudo nixos-rebuild switch --flake .#desktopThis configuration uses a hierarchical module system with feature flags:
Top-level options (defined in modules/options.nix):
cli.enable- CLI tools and terminal configurationgui.enable- GUI applicationsgeneral.enable- General system settingsdesktop.enable- Desktop environment
Module categories:
- CLI: Neovim, shells (zsh, starship), git, zellij, CLI utilities
- General: Nix settings, fonts, programming languages, utilities
- Desktop: Hyprland, GNOME, display managers, theming
- GUI: Browsers, development tools with GUI
Each module can be enabled/disabled independently in your profile configuration.
-
Create a new directory in
profiles/:mkdir -p profiles/myprofile
-
Create
profiles/myprofile/default.nix:{ pkgs, username, ... }: { imports = [ ./hardware-configuration.nix ./config.nix ../base.nix ]; # Your custom configuration environment.sessionVariables = { NIXHOST = "myprofile"; }; }
-
Add to
flake.nix:nixosConfigurations = { myprofile = helpers.mkSystem { system = "x86_64-linux"; inherit username hostname; profile = "myprofile"; }; };
In your profile's config.nix:
{
# Disable desktop environment
desktop.enable = false;
# Disable GUI applications
gui.enable = false;
}System-wide packages (in profile or module):
environment.systemPackages = with pkgs; [
your-package
];User packages (via Home Manager):
home.packages = with pkgs; [
your-package
];This repository includes pre-commit hooks for code formatting:
# Enter development shell
nix develop
# Hooks will run automatically on commit
git commit# Format all Nix files using nixfmt-rfc-style
nix fmt- Shell: zsh with starship prompt, zoxide directory navigation
- Editor: Neovim with extensive plugin configuration (LSP, completion, AI integration)
- Terminal Multiplexer: Zellij
- Version Control: Git with custom configuration
- System Monitoring: fastfetch, atuin (shell history)
- AI Tools: Integration with Claude and GitHub Copilot
- Window Manager: Hyprland (Wayland compositor)
- Alternative DE: GNOME
- Display Managers: SDDM (default), GDM
- Status Bar: Waybar
- Utilities: rofi, wlogout, hyprlock, hyprpaper
- Languages: gcc, python3 (configurable via
home.general.programlangs.packages) - LSP Support: Configured in Neovim for multiple languages
- Formatters: Language-specific formatters via conform.nvim
# Check for evaluation errors
nix flake check
# Show detailed trace
just testEnsure your user is in the correct groups:
groups $USERAlways test before applying:
just dry-build # Preview changes
just test # Check for errors
just build # Apply if no issues- LaTeX and Markdown preview in Neovim
- Additional desktop environment features
This configuration draws inspiration from:
This project is licensed under the MIT License - see the LICENSE file for details.
This is a personal configuration repository, but issues and suggestions are welcome. Feel free to fork and adapt for your own use.