Skip to content
nmcicchiPublic

About

My nixos desktop system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

nix-fleet

A modular, flake-based NixOS and Home Manager configuration managing a multi-machine desktop and homelab fleet from a single repository.


Fleet & Hosts

Configured via lib/mkHost.nix (and nixos-raspberrypi for rowan), with per-host and shared network settings centralized in fleet-settings.nix:

Host Arch Role / Modules Notes
lotus x86_64-linux Laptop (modules/pc/laptop, modules/pc/shared) Home Manager (nic@lotus), Steam/packages/unstable overlays
cedar x86_64-linux Desktop (modules/pc/desktop, modules/pc/shared) Home Manager (nic@cedar), AI, gaming, and audio modules
sequoia x86_64-linux Tower / Server (modules/server/tower, modules/server/shared) routing = true, tmpfs impermanence, rootless pods, self-hosted services
aspen x86_64-linux AI Server (modules/server/ai, modules/server/shared) cudaSupport = true, local inference, speech, VM
juniper aarch64-linux Assistant / Pi (modules/server/assistant, modules/server/pis, modules/server/shared) Includes aarch64 SD image builder
rowan aarch64-linux Dashboard / Pi 5 (modules/server/dashboard, modules/server/pis) Built with nixos-raspberrypi (raspberry-pi-5.base, sd-image)
installer x86_64-linux ISO (modules/iso.nix) Custom bootstrap/installer image

Repository Structure

.
├── flake.nix              # Inputs, dev templates, nixosConfigurations, and homeConfigurations
├── fleet-settings.nix     # Network config, host IPs/ports, and rootless pod UID/subUID mappings
├── lib/
│   ├── mkHost.nix         # NixOS system builder (pkgs, overlays, sops, fleetSettings, loadModules)
│   ├── mkHome.nix         # Home Manager configuration builder
│   ├── mkPod.nix          # Rootless Podman user + subUid/subGid + /persist helper
│   ├── load-modules.nix   # Directory `.nix` auto-loader (ignores `default.nix`, `_*`, `*~`)
│   └── gen-certs.sh       # Local CA & server cert generator encrypted via sops
├── modules/
│   ├── shared/            # Base NixOS modules applied to all mkHost machines
│   ├── custom/            # Reusable custom NixOS modules (adguard, nginx, syncthing, etc.)
│   ├── pc/                # Desktop (`cedar`), laptop (`lotus`), and shared PC modules
│   ├── server/            # Tower (`sequoia`), AI (`aspen`), assistant, dashboard, Pi, and shared server modules
│   ├── home/              # Home Manager configs (`shared`, `cedar`, `lotus`)
│   └── iso.nix            # Installer ISO configuration
├── overlays/              # `unstable`, `packages`, `steam`, `python-pin`, `rpi-go125`
├── pkgs/                  # Custom packages (`kairo`, `tide-island`)
├── nvf/                   # Neovim configuration via `nvf` (`nvFN.nix`, `nvf-configuration.nix`)
├── dotfiles/              # `mpv` config and `noctalia` shell config, colorschemes, and plugins
├── devFlakes/             # Flake templates (`java`, `jupyter`, `javascript`, `openSCAD`, `network`)
├── assets/                # Wallpapers and SVG icons
├── certs/                 # Local CA public certificate (`ca.pem`)
├── secrets/               # `sops-nix` encrypted secrets (`global.yaml`, `tower.yaml`, `laptop.yaml`, `certs.yaml`)
└── shell/                 # Zsh configuration and aliases

Architecture & Key Patterns

  • Builders (lib/mkHost.nix & lib/mkHome.nix): Standardize NixOS and Home Manager evaluation across hosts. mkHost automatically imports modules/shared, modules/custom, and sops-nix, sets up a single pkgs universe with overlays, and passes fleetSettings, networkSettings, and loadModules via specialArgs.
  • Automatic Module Loading (lib/load-modules.nix): loadModules ./. imports all regular .nix files in a directory while ignoring default.nix, files prefixed with _ (disabled/WIP modules), and editor backup files (*~).
  • Base System (modules/shared/): Configures flakes, America/New_York timezone, neovim as default editor, zsh (pure prompt) with symlinked shell configs, Tailscale mesh VPN, sops-nix, and trusts the internal CA (certs/ca.pem).
  • Secrets & Internal TLS (secrets/, certs/, lib/gen-certs.sh):
    • Admin workstations (lotus, cedar) decrypt secrets using /home/nic/.config/sops/age/keys.txt.
    • Servers derive age keys automatically from their SSH host keys (/persist/etc/ssh/ssh_host_ed25519_key on sequoia, /etc/ssh/ssh_host_ed25519_key elsewhere).
    • lib/gen-certs.sh generates or reuses the local CA (certs/ca.pem + ca-key in secrets/tower.yaml) and issues 825-day SAN certificates (secrets/certs.yaml) covering all enabled vhosts in sequoia's my.reverseProxy config.
  • Impermanence & Rootless Pods (sequoia & lib/mkPod.nix):
    • sequoia runs with impermanence mounted at /persist, preserving system state (/var/log, /var/lib/nixos, /var/lib/systemd, Tailscale state, /etc/machine-id, and SSH host keys).
    • mkPod provisions isolated non-login users with dedicated subUidRanges/subGidRanges, lingering systemd user sessions for rootless Podman containers, and /persist/home/<pod> storage.
  • Desktop & Home Manager (modules/home/, nvf/): Manages user environments (nic@lotus, nic@cedar) including Niri, Alacritty, Zen Browser, Yazi, Vicinae, Zed, nvf-configured Neovim, and Noctalia shell, with nh (flake = "/home/nic/nix-fleet/") and nix-direnv enabled on PCs.

Development Environments (Flake Templates)

Initialize an isolated devenv + direnv environment from devFlakes/:

nix flake init -t ~/nix-fleet#<template>
direnv allow

Available templates: java, jupyter, javascript, scad (devFlakes/openSCAD), and network.


Common Commands

# Rebuild / switch a NixOS host (uses /home/nic/nix-fleet/ on PCs)
nh os switch

# Update flake inputs and rebuild
nh os switch --update

# Switch Home Manager configuration
nh home switch # or: home-manager switch --flake .#nic@lotus

# Build an SD card image (rowan or juniper)
nix build .#nixosConfigurations.rowan.config.system.build.sdImage

# Generate/renew local CA & server certificates (valid 825 days)
nix-shell -p openssl sops jq git --run 'bash lib/gen-certs.sh'

Disko & Roadmap

  • Disko (disko input): Available in flake.nix for post-install disk partitioning, though not imported directly into host configs—disk layouts and drives.nix modules must be adapted per machine before running.
  • Planned:
    • Migrate dotfiles/noctalia configuration and plugins into Home Manager.
    • Implement deploy-rs (input already wired in flake.nix) for remote fleet deployments.

About

My nixos desktop system

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages