diff --git a/docs/plans/media-pc-replacement.md b/docs/plans/media-pc-replacement.md new file mode 100644 index 0000000..bbfd99a --- /dev/null +++ b/docs/plans/media-pc-replacement.md @@ -0,0 +1,211 @@ +# Media PC Replacement + +## Overview + +Replace the aging Linux+Kodi media PC connected to the TV with a modern, compact solution. Primary use cases are Jellyfin/Kodi playback and watching Twitch/YouTube. The current machine (`media`, 10.69.31.50) is on VLAN 31. + +## Current State + +### Hardware +- **CPU**: Intel Core i7-4770K @ 3.50GHz (Haswell, 4C/8T, 2013) +- **GPU**: Nvidia GeForce GT 710 (Kepler, GK208B) +- **OS**: Ubuntu 22.04.5 LTS (Jammy) +- **Software**: Kodi +- **Network**: `media.home.2rjus.net` at `10.69.31.50` (VLAN 31) + +### Control & Display +- **Input**: Wireless keyboard (works well, useful for browser) +- **TV**: 1080p (no 4K/HDR currently, but may upgrade TV later) +- **Audio**: Surround system connected via HDMI ARC from TV (PC → HDMI → TV → ARC → surround) + +### Notes on Current Hardware +- The i7-4770K is massively overpowered for media playback — it's a full desktop CPU from 2013 +- The GT 710 is a low-end passive GPU; supports NVDEC for H.264/H.265 hardware decode but limited to 4K@30Hz over HDMI 1.4 +- Ubuntu 22.04 is approaching EOL (April 2027) and is not managed by this repo +- The whole system is likely in a full-size or mid-tower case — not ideal for a TV setup + +### Integration +- **Media source**: Jellyfin on `jelly01` (10.69.13.14) serves media from NAS via NFS +- **DNS**: A record in `services/ns/external-hosts.nix` +- **Not managed**: Not a NixOS host in this repo, no monitoring/auto-updates + +## Options + +### Option 1: Dedicated Streaming Device (Apple TV / Nvidia Shield) + +| Aspect | Apple TV 4K | Nvidia Shield Pro | +|--------|-------------|-------------------| +| **Price** | ~$130-180 | ~$200 | +| **Jellyfin** | Swiftfin app (good) | Jellyfin Android TV (good) | +| **Kodi** | Not available (tvOS) | Full Kodi support | +| **Twitch** | Native app | Native app | +| **YouTube** | Native app | Native app | +| **HDR/DV** | Dolby Vision + HDR10 | Dolby Vision + HDR10 | +| **4K** | Yes | Yes | +| **Form factor** | Tiny, silent | Small, silent | +| **Remote** | Excellent Siri remote | Decent, supports CEC | +| **Homelab integration** | None | Minimal (Plex/Kodi only) | + +**Pros:** +- Zero maintenance - appliance experience +- Excellent app ecosystem (native Twitch, YouTube, streaming services) +- Silent, tiny form factor +- Great remote control / CEC support +- Hardware-accelerated codec support out of the box + +**Cons:** +- No NixOS management, monitoring, or auto-updates +- Can't run arbitrary software +- Jellyfin clients are decent but not as mature as Kodi +- Vendor lock-in (Apple ecosystem / Google ecosystem) +- No SSH access for troubleshooting + +### Option 2: NixOS Mini PC (Kodi Appliance) + +A small form factor PC (Intel NUC, Beelink, MinisForum, etc.) running NixOS with Kodi as the desktop environment. + +**NixOS has built-in support:** +- `services.xserver.desktopManager.kodi.enable` - boots directly into Kodi +- `kodi-gbm` package - Kodi with direct DRM/KMS rendering (no X11/Wayland needed) +- `kodiPackages.jellycon` - Jellyfin integration for Kodi +- `kodiPackages.sendtokodi` - plays streams via yt-dlp (Twitch, YouTube) +- `kodiPackages.inputstream-adaptive` - adaptive streaming support + +**Example NixOS config sketch:** +```nix +{ pkgs, ... }: +{ + services.xserver.desktopManager.kodi = { + enable = true; + package = pkgs.kodi.withPackages (p: [ + p.jellycon + p.sendtokodi + p.inputstream-adaptive + ]); + }; + + # Auto-login to Kodi session + services.displayManager.autoLogin = { + enable = true; + user = "kodi"; + }; +} +``` + +**Pros:** +- Full NixOS management (monitoring, auto-updates, vault, promtail) +- Kodi is a proven TV interface with excellent remote/CEC support +- JellyCon integrates Jellyfin library directly into Kodi +- Twitch/YouTube via sendtokodi + yt-dlp or Kodi browser addons +- Can run arbitrary services (e.g., Home Assistant dashboard) +- Declarative, reproducible config in this repo + +**Cons:** +- More maintenance than an appliance +- NixOS + Kodi on bare metal needs GPU driver setup (Intel iGPU is usually fine) +- Kodi YouTube/Twitch addons are less polished than native apps +- Need to buy hardware (~$150-400 for a decent mini PC) +- Power consumption higher than a streaming device + +### Option 3: NixOS Mini PC (Wayland Desktop) + +A mini PC running NixOS with a lightweight Wayland compositor, launching Kodi for media and a browser for Twitch/YouTube. + +**Pros:** +- Best of both worlds: Kodi for media, Firefox/Chromium for Twitch/YouTube +- Full NixOS management +- Can switch between Kodi and browser easily +- Native web experience for streaming sites + +**Cons:** +- More complex setup (compositor + Kodi + browser) +- Harder to get a good "10-foot UI" experience +- Keyboard/mouse may be needed alongside remote +- Significantly more maintenance + +## Comparison + +| Criteria | Dedicated Device | NixOS Kodi | NixOS Desktop | +|----------|-----------------|------------|---------------| +| **Maintenance** | None | Low | Medium | +| **Media experience** | Excellent | Excellent | Good | +| **Twitch/YouTube** | Excellent (native apps) | Good (addons/yt-dlp) | Excellent (browser) | +| **Homelab integration** | None | Full | Full | +| **Form factor** | Tiny | Small | Small | +| **Cost** | $130-200 | $150-400 | $150-400 | +| **Silent operation** | Yes | Likely (fanless options) | Likely | +| **CEC remote** | Yes | Yes (Kodi) | Partial | + +## Decision: NixOS Mini PC with Kodi (Option 2) + +**Rationale:** +- Already comfortable with Kodi + wireless keyboard workflow +- Browser access for Twitch/YouTube is important — Kodi can launch a browser when needed +- Homelab integration comes for free (monitoring, auto-updates, vault) +- Natural fit alongside the other 16 NixOS hosts in this repo +- Dedicated devices lose the browser/keyboard workflow + +### Twitch/YouTube in Kodi + +Several approaches, can mix and match: +- **sendtokodi** addon + yt-dlp — paste/send URLs, plays via yt-dlp backend. Supports Twitch and YouTube. +- **Kodi web browser** — launch a full browser from within Kodi (falls back to keyboard input) +- **Tube addon** / YouTube plugin — dedicated YouTube browsing within Kodi UI + +The browser fallback with the wireless keyboard means streaming sites will always work even if Kodi addons are flaky. + +### Audio Passthrough + +Kodi on NixOS supports HDMI audio passthrough for surround formats (AC3, DTS, etc.). The ARC chain (PC → HDMI → TV → ARC → surround) works transparently — Kodi just needs to be configured for passthrough rather than decoding audio locally. + +## Hardware + +### Leading Candidate: GMKtec G3 + +- **CPU**: Intel N100 (Alder Lake-N, 4C/4T) +- **RAM**: 16GB +- **Storage**: 512GB NVMe +- **Price**: ~NOK 2800 (~$250 USD) +- **Source**: AliExpress + +The N100 supports hardware decode for all relevant 4K codecs: + +| Codec | Support | Used by | +|-------|---------|---------| +| H.264/AVC | Yes (Quick Sync) | Older media | +| H.265/HEVC 10-bit | Yes (Quick Sync) | Most 4K media, HDR | +| VP9 | Yes (Quick Sync) | YouTube 4K | +| AV1 | Yes (Quick Sync) | YouTube, Twitch, newer encodes | + +16GB RAM is comfortable for Kodi + browser + NixOS system services (node-exporter, promtail, etc.) with plenty of headroom. + +### Key Requirements +- HDMI 2.0+ for 4K future-proofing (current TV is 1080p) +- Hardware video decode via VA-API / Intel Quick Sync +- HDR support (for future TV upgrade) +- Fanless or near-silent operation + +## Implementation Steps + +1. **Choose and order hardware** +2. **Create host configuration** (`hosts/media1/`) + - Kodi desktop manager with Jellyfin + streaming addons + - Intel/AMD iGPU driver and VA-API hardware decode + - HDMI audio passthrough for surround + - NFS mount for media (same pattern as jelly01) + - Browser package (Firefox/Chromium) for Twitch/YouTube fallback + - Standard system modules (monitoring, promtail, vault, auto-upgrade) +3. **Install NixOS** on the mini PC +4. **Configure Kodi** (Jellyfin server, addons, audio passthrough) +5. **Update DNS** - point `media.home.2rjus.net` to new IP (or keep on VLAN 31) +6. **Retire old media PC** + +## Open Questions + +- [x] What are the current media PC specs? — i7-4770K, GT 710, Ubuntu 22.04. Overkill CPU, weak GPU, large form factor. Not worth reusing if goal is compact/silent. +- [x] VLAN? — Keep on VLAN 31 for now, same as current media PC. Can revisit later. +- [x] Is CEC needed? — No, not using it currently. Can add later if desired. +- [x] Is 4K HDR output needed? — TV is 1080p now, but want 4K/HDR capability for future TV upgrade +- [x] Audio setup? — Surround system via HDMI ARC from TV. Media PC outputs HDMI to TV, TV passes audio to surround via ARC. Kodi/any player just needs HDMI audio output with surround passthrough. +- [x] Are there streaming service apps needed? — No. Only Twitch/YouTube, which work fine in any browser. +- [x] Budget? — ~NOK 2800 for GMKtec G3 (N100, 16GB, 512GB NVMe) diff --git a/docs/plans/nixos-router.md b/docs/plans/nixos-router.md index 4a15a40..ef0a69e 100644 --- a/docs/plans/nixos-router.md +++ b/docs/plans/nixos-router.md @@ -42,10 +42,24 @@ Needs a small x86 box with: - 4-8 GB RAM (plenty for routing + DHCP + NetFlow accounting) - Low power consumption, fanless preferred for always-on use -Candidates: -- Topton / CWWK mini PC with dual/quad Intel 2.5GbE (~100-150 EUR) -- Protectli Vault (more expensive, ~200-300 EUR, proven in pfSense/OPNsense community) -- Any mini PC with one onboard NIC + one USB 2.5GbE adapter (cheapest, less ideal) +**Leading candidate:** [Topton Solid Mini PC](https://www.aliexpress.com/item/1005008981218625.html) +with Intel i3-N300 (8 E-cores), 2x10GbE SFP+ + 3x2.5GbE (~NOK 3000 barebones). The N300 +gives headroom for ntopng DPI and potential Suricata IDS without being overkill. + +### Hardware Alternatives + +Domestic availability for firewall mini PCs is limited — likely ordering from AliExpress. + +Key things to verify: +- NIC chipset: Intel i225-V/i226-V preferred over Realtek for Linux driver support +- RAM/storage: some listings are barebones, check what's included +- Import duties: factor in ~25% on top of listing price + +| Option | NICs | Notes | Price | +|--------|------|-------|-------| +| [Topton Solid Firewall Router](https://www.aliexpress.com/item/1005008059819023.html) | 2x10GbE SFP+, 4x2.5GbE | No RAM/SSD, only Intel N150 available currently | ~NOK 2500 | +| [Topton Solid Mini PC](https://www.aliexpress.com/item/1005008981218625.html) | 2x10GbE SFP+, 3x2.5GbE | No RAM/SSD, only Intel i3-N300 available currently | ~NOK 3000 | +| [MINISFORUM MS-01](https://www.aliexpress.com/item/1005007308262492.html) | 2x10GbE SFP+, 2x2.5GbE | No RAM/SSD, i5-12600H | ~NOK 4500 | The LAN port would carry a VLAN trunk to the MikroTik switch, with sub-interfaces for each VLAN. WAN port connects to the ISP uplink. @@ -89,6 +103,12 @@ The router is treated differently from the rest of the fleet: - nftables flow accounting or softflowd for NetFlow export - Export to future ntopng instance (see new-services.md) +**IDS/IPS (future consideration):** +- Suricata for inline intrusion detection/prevention on the WAN interface +- Signature-based threat detection, protocol anomaly detection +- CPU-intensive — feasible at typical home internet speeds (500Mbps-1Gbps) on the N300 +- Not a day-one requirement, but the hardware should support it + ### Monitoring Integration Since this is a NixOS host in the flake, it gets the standard monitoring stack for free: