A comprehensive NixOS configuration using Nix Flakes for declarative system and user environment management across multiple machines.
Enter the development shell to get all necessary tools (make
, nh
, git
, etc.):
# Option 1: Manual activation
nix develop
# Option 2: Automatic with direnv
direnv allow
# Switch NixOS configuration
make switch
# Switch home-manager configuration
make home-switch
# Update flake inputs
make update
# Show all available commands
make help
Set up a development VM for testing configurations:
# Get detailed VM setup instructions
make vm/setup-help
# Quick workflow (after VM setup):
export NIXADDR=root@VM_IP
make vm/bootstrap0 # Initial VM setup
export NIXADDR=przemek@VM_IP
make vm/bootstrap # Apply configuration
make vm/switch # Deploy changes
Build and install NixOS WSL distribution with CLI tools from dev-vm configuration:
make wsl
This creates a WSL distribution tarball builder. To generate the actual tarball:
sudo result/bin/nixos-wsl-tarball-builder
This produces a nixos.wsl
file ready for Windows installation.
-
Transfer the tarball: Copy
nixos.wsl
to your Windows machine -
Install WSL distribution (run in PowerShell as Administrator):
wsl --import NixOS C:\WSL\NixOS C:\path\to\nixos.wsl
-
Set as default (optional):
wsl --set-default NixOS
-
Launch NixOS WSL:
wsl -d NixOS
- List distributions:
wsl --list --verbose
- Stop distribution:
wsl --terminate NixOS
- Uninstall:
wsl --unregister NixOS
- Update: Rebuild tarball and re-import
The WSL configuration includes CLI development tools from dev-vm:
- Modern shell (Fish with completions)
- Development tools (git, nvim, tmux, fzf, ripgrep, etc.)
- Programming languages (Node.js, Python 3)
- Container tools (docker-compose)
- Network utilities (SSH, Tailscale)
- Nix package manager with flakes enabled
This flake supports multiple machines:
- ilum - Gaming desktop
- dathomir - Dell laptop
- dooku - Lenovo ThinkPad
- dev-vm - Development VM (universal: QEMU/KVM, Hyper-V, VirtualBox)
- Modular design - Shared configuration with host-specific overrides
- Multiple nixpkgs channels - Stable, unstable, and legacy for compatibility
- Universal VM support - Works across different hypervisors
- Makefile automation - Simple commands for all operations
- bspwm/Hyprland desktop environments
- Comprehensive app configurations (Neovim, Firefox, development tools)
- VM-optimized configurations for development
- Remote deployment with deploy-rs
- Automatic formatting and development tools
- NixOS & Flakes Book - Comprehensive guide
- devenv - Development environments
- Flake templates - Starting templates
flake.nix
- Main flake configurationlib/mkSystem.nix
- System configuration factoryhosts/
- Machine-specific configurationsMakefile
- Development workflow automationCLAUDE.md
- Claude Code assistant reference
# Check configuration syntax
make check
# Format Nix files
make fmt
# Clean broken symbolic links
find -L /nix/var/nix/gcroots/per-user/$USER -maxdepth 1 -type l -delete