Files
homelab/hosts/mercury/configuration.nix
T
erik fd3ccf5f07 feat(mercury): pihole via container (native FTL segfaults on aarch64)
- services/pihole.nix: official pihole/pihole:2026.07.2 via podman, host net,
  caps NET_ADMIN/NET_RAW/SYS_NICE/CHOWN; FTLCONF_* env config (upstream unbound,
  DHCP 50-200, static lease jupiter, .sol domain, local records)
- unbound: resolveLocalQueries=false (was hijacking resolv.conf to :53 -> boot
  DNS deadlock; the real root cause of the earlier failures too)
- password via sops FTLCONF env file; /var/lib/pihole created via tmpfiles
- VM-verified: mercury.sol/jupiter.sol/external all resolve, 0 restarts
2026-07-14 00:10:43 +02:00

45 lines
2.1 KiB
Nix

{ config, pkgs, lib, ... }:
# mercury — Raspberry Pi 3B+ (aarch64). Network DNS + DHCP (+ adblock).
# Boots from an SD image (see flake: nixosConfigurations.mercury), so there is
# no disko / hardware-configuration here — the sd-image module provides them.
{
imports = [
../../common.nix # shared base: user / ssh / nix / firewall
./secrets.nix # sops-nix: darman password (age key on boot part.)
../../services/unbound.nix # local recursive resolver (127.0.0.1:5335)
../../services/pihole.nix # DNS adblock + DHCP (declarative static leases)
];
networking.hostName = "mercury";
# ---- Static networking ----
# A DNS/DHCP server must have a fixed address. Fill in the Pi's real values
# (from `ip -brief a` / `ip route` on the running Pi). eth0 = the Pi's NIC.
networking.useDHCP = false;
networking.usePredictableInterfaceNames = false; # keep it named eth0
networking.interfaces.eth0.ipv4.addresses = [
{ address = "10.0.0.10"; prefixLength = 24; } # the Pi's current IP
];
# VERIFY with `ip route` on the Pi — assuming the router is .1.
networking.defaultGateway = { address = "10.0.0.1"; interface = "eth0"; };
# Resolvers for the Pi's OWN lookups (not the LAN service). Kept public so the
# host resolves during boot without depending on its own pihole/unbound.
networking.nameservers = [ "1.1.1.1" "9.9.9.9" ];
# DNS adblock + DHCP (pihole) and the recursive resolver (unbound) come from
# the imported service modules. pihole forwards to unbound at 127.0.0.1:5335.
# ---- pihole web admin password (from sops) ----
# The pihole container reads FTLCONF_* env vars. Render an env file from the
# sops secret and feed it to the container — password stays out of repo/store.
sops.secrets.pihole_webpassword = { };
sops.templates."pihole.env".content =
"FTLCONF_webserver_api_password=${config.sops.placeholder.pihole_webpassword}";
virtualisation.oci-containers.containers.pihole.environmentFiles =
[ config.sops.templates."pihole.env".path ];
# Do not modify after first flash.
system.stateVersion = "26.05";
}