This repository contains NixOS and home-manager configurations for multiple machines with a modular, best-practices approach.
.
├── flake.nix # Main flake configuration
├── nixos/
│ ├── common/
│ │ ├── base.nix # Core settings for all machines
│ │ └── desktop.nix # Desktop-specific settings
│ ├── nixos-pc/ # Desktop workstation
│ ├── nixos-nb/ # Notebook/Laptop
│ └── nixos-hs/ # Home server
└── home-manager/
└── lev/
├── common.nix # Common home settings
├── home-nixos-pc.nix # PC-specific home config
├── home-nixos-nb.nix # Notebook-specific home config
└── home-nixos-hs.nix # Server-specific home config
nixos/common/base.nix: Core settings shared by all machines (Nix, networking, users, SSH, Docker)nixos/common/desktop.nix: Desktop-specific settings (X11, Plasma, printing, scanning, fonts)- Machine configs import only what they need
Each machine has its own home-manager configuration with appropriate packages:
- PC (
home-nixos-pc.nix): Full desktop workstation with development tools, creative apps, office suite - Notebook (
home-nixos-nb.nix): Lighter configuration for portable use - Server (
home-nixos-hs.nix): Minimal CLI tools and server utilities
- ✅ Separation of concerns (base vs desktop vs machine-specific)
- ✅ No redundant packages across machines
- ✅ Server has firewall enabled by default
- ✅ Desktop-specific settings not included in server config
- ✅ Common settings extracted to reusable modules
- ✅ Clear documentation and comments
Build and switch to a configuration:
sudo nixos-rebuild switch --flake .#nixos-pc
sudo nixos-rebuild switch --flake .#nixos-nb
sudo nixos-rebuild switch --flake .#nixos-hsSwitch to per-machine home configuration:
home-manager switch --flake .#lev@nixos-pc
home-manager switch --flake .#lev@nixos-nb
home-manager switch --flake .#lev@nixos-hsThe legacy configuration lev is still available for backward compatibility.
- Create directory:
mkdir -p nixos/nixos-new - Copy and customize configuration:
cp nixos/nixos-nb/configuration.nix nixos/nixos-new/ cp nixos/nixos-nb/hardware-configuration.nix nixos/nixos-new/
- Update hostname in
configuration.nix - Generate hardware config:
nixos-generate-config --show-hardware-config > nixos/nixos-new/hardware-configuration.nix - Create home config:
cp home-manager/lev/home-nixos-nb.nix home-manager/lev/home-nixos-new.nix - Update
flake.nix:nixos-new = "nixos-new"; # Add to nixosConfigurations and homeConfigurations
- Create directory:
mkdir -p nixos/nixos-hs2 - Copy server configuration:
cp nixos/nixos-hs/configuration.nix nixos/nixos-hs2/ cp nixos/nixos-hs/hardware-configuration.nix nixos/nixos-hs2/
- Update hostname in
configuration.nix - Create home config:
cp home-manager/lev/home-nixos-hs.nix home-manager/lev/home-nixos-hs2.nix - Update
flake.nixsimilarly
- Core CLI tools: bat, eza, fd, ripgrep, zoxide, etc.
- Development essentials: git, helix, nixd
- Shell tools: zellij, bottom, yazi
- GUI applications
- Development environments
- Office and productivity tools
- Heavy applications: Steam, creative software
- GPU monitoring tools
- Full development stack
- Lighter application set
- Essential tools for mobile work
- Battery-conscious choices
- Server monitoring tools
- Minimal development tools
- No GUI applications
- DRY (Don't Repeat Yourself): Common settings are extracted to shared modules
- Explicit over Implicit: Each machine explicitly imports what it needs
- Security by Default: Servers have firewall enabled, SSH properly configured
- Modularity: Easy to add/remove features per machine
- Documentation: Clear structure and usage instructions