This repository contains a modular NixOS configuration for managing multiple host systems using Nix flakes. The configuration is designed to be maintainable, reusable, and organized around a clear separation of concerns.
The configuration currently manages three host systems:
- pluto (x86_64-linux) - Desktop system
- juno (x86_64-linux) - Tablet system
- charon (aarch64-linux) - Lenovo ThinkPad X13s
nixos/
├── hosts/ # Host-specific configurations
│ ├── _shared.nix # Common configuration shared across all hosts
│ ├── pluto.nix # Configuration for pluto host
│ ├── juno.nix # Configuration for juno host
│ └── charon.nix # Configuration for charon host
├── hardware/ # Hardware-specific configurations
│ ├── pluto.nix # Hardware configuration for pluto
│ ├── juno.nix # Hardware configuration for juno
│ └── charon.nix # Hardware configuration for charon
├── users/ # User account configurations
│ └── maik.nix # User configuration for maik
├── gui/ # Desktop environment configurations
│ ├── gnome.nix # GNOME desktop environment
│ ├── plasma.nix # KDE Plasma desktop environment
│ ├── sway.nix # Sway window manager
│ └── niri.nix # Niri window manager
├── capabilities/ # Modular capability configurations
│ ├── chipcards.nix # Smart card support
│ ├── fan2go.nix # Fan control
│ ├── gnupg.nix # GnuPG configuration
│ ├── pipewire.nix # PipeWire audio system
│ ├── printing.nix # Printing support
│ ├── scanning.nix # Document scanning
│ ├── ssh.nix # SSH configuration
│ ├── steam.nix # Steam gaming platform
│ ├── vscode.nix # Visual Studio Code
│ └── vscodium.nix # VSCodium (open source VS Code)
├── patches/ # Custom patches and modifications
├── flake.nix # Main flake configuration
└── flake.lock # Locked dependency versions
The configuration follows a modular approach:
- Shared Configuration: Common settings applied to all hosts are defined in
hosts/_shared.nix - Host-Specific: Each host imports the shared configuration and adds its own customizations
- Hardware Abstraction: Hardware-specific settings are separated into dedicated files
- Capability Modules: Features like audio, printing, and development tools are modularized
- Desktop Environments: GUI configurations are kept separate and can be mixed and matched
- NixOS installed on your system
- Nix flakes enabled in your configuration
- Git for cloning the repository
-
Clone this repository:
git clone <repository-url> cd nixos
-
Build and switch to a configuration:
# For the juno host sudo nixos-rebuild switch --flake .#juno # For the charon host sudo nixos-rebuild switch --flake .#charon # For the pluto host sudo nixos-rebuild switch --flake .#pluto
A development shell is provided with useful tools:
nix developThis includes:
gitMinimal- Git version controlnil- Nix language serveralejandra- Nix code formatter
- Boot Configuration: Systemd-boot with silent boot process
- Time Zone: Europe/Berlin
- Localization: German locale and keyboard layout
- Security: Immutable users, sudo access for wheel group
- Storage: zram swap, fscrypt home directories
- Network: NFS automount for shared storage
- Nix Settings: Flakes enabled, automatic garbage collection, auto-upgrades
- GNOME desktop environment with GDM
- Power optimization for mobile use
- Bluetooth and WiFi support
- Custom audio equalizer for StarLabs speakers
- Syncthing for file synchronization
- KDE Plasma desktop environment
- Lenovo ThinkPad X13s ARM support via nixos-x13s
- Autologin with greetd
- Kodi media center
- Custom audio equalizer for X13s speakers
- Podman containerization
- Audio: PipeWire with low-latency audio
- Printing: CUPS with driver support
- Scanning: SANE document scanning
- Development: VS Code/VSCodium with extensions
- Security: GnuPG, SSH, smart card support
- Gaming: Steam (when enabled)
- System: Fan control, power management
- Create hardware configuration:
hardware/newhost.nix - Create host configuration:
hosts/newhost.nix - Add to
flake.nixnixosConfigurations - Import desired capabilities and GUI modules
- Create a new module in
capabilities/ - Follow the existing pattern of exposing configuration options
- Import the capability in relevant host configurations
User configurations are defined in users/. To add a new user:
- Create
users/username.nix - Define user account, SSH keys, and shell preferences
- Import in relevant host configurations
The configuration uses:
- nixpkgs: NixOS 25.05 (stable)
- nixos-x13s: ARM laptop support for ThinkPad X13s
The system is configured for automatic updates via system.autoUpgrade, but you can manually update:
# Update flake inputs
nix flake update
# Rebuild with new inputs
sudo nixos-rebuild switch --flake .#<hostname>Automatic garbage collection is enabled, but you can manually clean up:
# Collect garbage older than 7 days
sudo nix-collect-garbage --delete-older-than 7d
# Optimize nix store
sudo nix-store --optimizeWhen making changes:
- Test configurations in a VM or on non-production systems first
- Use
alejandrato format Nix code - Keep the modular structure intact
- Document any new capabilities or significant changes
- Users are immutable (defined in configuration)
- SSH is configured with public key authentication only
- Home directories use fscrypt encryption
- Firewall is enabled with specific port allowances
- Automatic security updates are enabled
This is a personal NixOS configuration. For general NixOS help: