4.7 KiB
4.7 KiB
NixOS-Configs
My NixOS system configurations managed with Nix flakes, home-manager, and colmena for multi-host deployment.
Overview
This repository contains NixOS configurations for multiple hosts including workstations, servers, and Raspberry Pi systems. It uses:
- Nix Flakes for reproducible builds and dependency management
- home-manager for user environment configuration
- colmena for multi-host deployment
- sops-nix for secrets management
- Role-based configuration for modular host setup
Host Categories
Workstations
loki- Framework AMD AI 300 (primary development machine)book- Google Pixelbook 2017dragon- Custom workstationace- Acer C720eve- Google Pixelbook 2017 (eMMC)pocket2- Mobile workstationsmaug- ThinkPad x260
Servers
w1- Hetzner VPSfred- Acer serverharper- Serverharper2- Servernuwww- Web serverwww2- Web serverpihole- Pi-hole server
Raspberry Pi Systems
pi1- Raspberry Pidisplay- Pi 4 with kiosk display
Virtual Machines
vm- Generic VMvm1- VM configuration
Quick Start
Prerequisites
- Nix with flakes enabled
- Age key for secrets decryption (see secrets section)
Building a Host
# Test build without installing
just test <hostname>
# Apply configuration to host
just switch <hostname>
# Apply and reboot
just bootswitch <hostname>
Updating
# Update flake.lock
just update
# Apply updates to all hosts
just world
Available Commands
just test <host>- Build and validate configurationjust switch <host>- Apply configurationjust boot <host>- Apply configuration for next bootjust world- Deploy to all hostsjust workstation- Deploy to workstation hostsjust server- Deploy to server hostsjust web- Deploy to web hostsjust clean <host>- Clean old generations and optimize storejust update- Update flake.lockjust format- Format Nix code
Configuration Structure
Host Configuration
Each host in hosts/<hostname>/ follows this pattern:
{
imports = [ ../templates/workstation.nix ]; # Base template
networking.hostName = "hostname";
variables.address = "100.72.x.x"; # Tailscale IP
roles = {
gui.enable = true;
games.enable = true;
wm = "sway";
};
}
Roles
Hosts are configured using role-based modules:
gui- Graphical user interface packagesgames- Gaming packages and Steamcitrix- Citrix Workspace clientzoom- Zoom clientkvm- Virtualization supportkmscon- Console improvementsauto-cpufreq- CPU power management
Window Managers
sway- Wayland compositor (default for workstations)gnome- GNOME desktop environment
Home Manager
User configurations are managed separately:
home/common/- Common packages and settings for all usershome/gui/- GUI-specific user configurationhome/work/- Work-related packages and settings
Secrets Management
Secrets are encrypted using sops-nix with Age keys.
Setup
-
Generate Age key pair:
nix run nixpkgs#age -- -generate-keypair -
Add public key to
.sops.yaml:keys: - &host_<name> <public_key> creation_rules: - path_regex: secrets.yaml$ key_groups: - age: - *host_<name> -
Encrypt secrets:
sops --encrypt secrets.yaml > secrets.yaml.enc
Usage in Configuration
# In host configuration
sops.secrets."service/password".path
Development
Adding a New Host
- Create
hosts/<hostname>/default.nix - Add hardware configuration if needed
- Import appropriate template (
workstation.nix,server.nix, etc.) - Configure roles and variables
- Add to
flake.nixoutputs - Test with
just test <hostname>
Template Types
hosts/templates/workstation.nix- Full desktop/workstationhosts/templates/server.nix- Server configurationhosts/templates/pi-server.nix- Raspberry Pi server
Code Quality
- Format code:
just format - Check configuration:
nix flake check - Validate secrets: Ensure
.sops.yamlhas correct public keys
Troubleshooting
Common Issues
- Build fails: Check
nix flake showfor syntax errors - Secrets not found: Verify Age key is in
~/.config/sops/age/keys.txt - Network issues: Check Tailscale connectivity
- Home manager conflicts: Remove backup files:
locate home-manager-backup | xargs rm
Logs
Build logs are saved to nixos-switch.log. Check this file for detailed error information.
Contributing
- Test changes on a single host first
- Update documentation for new features
- Clean up FIXME/DELME comments
- Format code before committing