Files
nixos-setup/modules/nixos/server/ABOUTME.md
T
2026-10-23 15:26:04 -04:00

63 lines
3.6 KiB
Markdown

# modules/nixos/server/
Opt-in server roles and self-hosted services for the homelab. `default.nix` imports every
subtree; each module/service is individually enabled — there is **no** single master server
switch, so a host only runs what it explicitly turns on.
## Structure
```
server/
├── default.nix # imports everything below
├── admin.nix # skyg.server.admin — www-data group/user for shared web data
├── timers.nix # skyg.server.timers — generic attrset → systemd timer+oneshot service
├── acme/ # skyg.server.acme — Let's Encrypt certs via DNS-01 (lego), no internet exposure
├── arrs/ # *arr media-automation stack (prowlarr/sonarr/radarr) + postgres
├── dns/ # Local DNS resolver, certbot, local CA
├── k3s/ # Single-binary K3s cluster role
├── k8s/ # Full upstream Kubernetes (master/node)
├── portainer.nix # skyg.nixos.server.portainer — Portainer server or Edge agent
├── robotnix/ # skyg.nixos.server.robotnix — self-managed NixOS nspawn containers
└── services/ # Self-hosted apps (jellyfin, audiobookshelf, comfyui, ds4, colibri, ai…)
```
## Notable details
- **`timers.nix`** is a reusable helper: anything added to `skyg.server.timers.<name>`
(with `script`, `OnCalendar`, `wantedBy`) becomes a systemd timer + oneshot service. Host
files (e.g. `hosts/hl-minipc2.nix`'s scrypted-backups) use it for backups/auto-updates.
- No per-host Prometheus exporters: metrics are **pushed**. Every lab host runs
`skyg-linux-tracker` and ships OTLP to the collector on bigbox2
(`hosts/hl-bigbox2/services/otel-collector.nix`), which feeds Prometheus and Loki.
- Naming: this tree mostly uses the legacy `skyg.server.*` prefix for cross-cutting modules
(admin/timers/arrs/dns) and `skyg.nixos.server.*` for the K3s/K8s roles and the
service modules under `services/`.
| Structure | Namespace | Notes |
| ------------ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `robotnix/` | `skyg.nixos.server.robotnix` | Self-managed NixOS nspawn containers (persistent system, own LAN IP, snapshots, host-controlled web access). The one sanctioned nspawn exception to the oci-containers rule |
| `timers.nix` | `skyg.server.timers` | Generic attrset → timer + oneshot service (robotnix snapshot timers use it) |
## Option Namespace
```
skyg.server.admin.enable → admin.nix
skyg.server.timers.<name> → timers.nix
skyg.server.acme.* → acme/
skyg.server.arrs.* → arrs/
skyg.server.dns.* → dns/
skyg.nixos.server.k3s.* → k3s/
skyg.nixos.server.k8s.* → k8s/
skyg.nixos.server.robotnix.* → robotnix/ (self-managed nspawn containers)
skyg.nixos.server.services.* → services/
skyg.nixos.server.portainer.* → portainer.nix
```
## Conventions
- Every role/service defaults to `false`; enable per-host in `hosts/<hostname>.nix`.
- Services that need ports should expose an `openFirewall` option rather than opening ports
unconditionally. See `GUIDELINES.md` in this folder for the full service-authoring pattern.