3.2 KiB
3.2 KiB
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
└── services/ # Self-hosted apps (jellyfin, audiobookshelf, comfyui, ds4, colibri, ai…)
Notable details
timers.nixis a reusable helper: anything added toskyg.server.timers.<name>(withscript,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-trackerand 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) andskyg.nixos.server.*for the K3s/K8s roles and the service modules underservices/.
| Structure | Namespace | Notes |
|---|---|---|
timers.nix |
skyg.server.timers |
Generic attrset → timer + oneshot service |
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.services.* → services/
skyg.nixos.server.portainer.* → portainer.nix
Conventions
- Every role/service defaults to
false; enable per-host inhosts/<hostname>.nix. - Services that need ports should expose an
openFirewalloption rather than opening ports unconditionally. SeeGUIDELINES.mdin this folder for the full service-authoring pattern.