Files
JakeHillion 8326e660f7
commit-validation / validate-single-commit (pull_request) Successful in 7s
buildbot/nix-eval Build done. (655 warnings)
buildbot/nix-build Build done.
buildbot/nix-effects Build done.
portal: enable snapcast volume sync
2026-09-11 23:54:41 +01:00

148 lines
4.2 KiB
Nix
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, pkgs, lib, ... }:
{
imports = [
./disko.nix
./hardware-configuration.nix
];
config = {
system.stateVersion = "24.05";
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
custom.defaults = true;
custom.locations.autoServe = true;
custom.impermanence.enable = true;
ogygia.nebula = {
groups = [ "legacy-full-access" ];
pubKey = ''
-----BEGIN NEBULA X25519 PUBLIC KEY-----
tKsz6tQke2pxIpxnZrqtERvTLNAbAUzC7w1pAKprITg=
-----END NEBULA X25519 PUBLIC KEY-----
'';
};
custom.tang = {
enable = true;
networkingModule = "r8169";
secretFile = "/data/disk_encryption.jwe";
devices = [ "disk0-crypt" ];
};
hardware = {
bluetooth.enable = true;
};
# Networking
networking = {
interfaces.enp1s0 = {
name = "eth0";
ipv4.addresses = [
{
address = "10.64.50.29";
prefixLength = 24;
}
];
};
# The vlan declaration auto-creates an empty networking.interfaces.eth0
# entry; in nixpkgs 26.05's strict initrd networkd generator that
# produced a second `40-eth0` network claiming DHCP=yes (no addresses)
# while the enp1s0 rename produced DHCP=no. Pin both to no.
interfaces.eth0.useDHCP = false;
defaultGateway = "10.64.50.1";
vlans = {
iot = {
id = 2;
interface = "eth0";
};
};
interfaces.iot = {
ipv4.addresses = [
{
address = "10.239.19.8";
prefixLength = 24;
}
];
};
};
# Force-accept RAs on eth0 despite forwarding=1 (set by OTBR for the
# Thread mesh). Without this, eth0 ignores RAs and never SLAACs.
boot.kernel.sysctl."net.ipv6.conf.eth0.accept_ra" = 2;
# Use local dnsmasq as caching resolver
networking.nameservers = lib.mkForce [ "127.0.0.1" ];
# Configure dnsmasq as local caching DNS resolver
services.dnsmasq = {
enable = true;
settings = {
# Use external DNS servers for upstream resolution
server = [ "1.1.1.1" "8.8.8.8" ];
# Cache settings - larger cache for better performance
cache-size = 10000;
# Only bind to localhost to prevent external access
listen-address = [ "127.0.0.1" "::1" ];
bind-interfaces = true;
# Don't read /etc/resolv.conf
no-resolv = true;
# Log queries for debugging (remove if not needed)
log-queries = true;
};
};
networking.firewall = {
allowedTCPPorts = lib.mkForce [
22 # SSH
];
allowedUDPPorts = lib.mkForce [ ];
interfaces = {
eth0 = {
allowedTCPPorts = lib.mkForce [
80 # HTTP 1-2
443 # HTTPS 1-2
1400 # HA Sonos
5000 # snapcast AirPlay 2 RTSP/control (shairport-sync)
5354 # snapcast Spotify Connect (go-librespot zeroconf)
7654 # Tang
21063 # HomeKit
];
allowedUDPPorts = lib.mkForce [
319 # snapcast AirPlay 2 PTP (nqptp)
320 # snapcast AirPlay 2 PTP (nqptp)
443 # HTTP 3
5353 # HomeKit / mDNS
49191 # OTBR MeshCoP BorderAgent
];
# AirPlay 2 binds dynamically-assigned ephemeral ports for its event,
# audio, control and timing channels. udp_port_base/range only pin
# AirPlay 1, so AP2's ports can't be constrained; open the kernel
# ephemeral range on the trusted LAN so the sender can reach whatever
# shairport-sync picks per session.
allowedTCPPortRanges = [
{ from = 32768; to = 60999; } # snapcast AirPlay 2 dynamic ports
];
allowedUDPPortRanges = [
{ from = 32768; to = 60999; } # snapcast AirPlay 2 dynamic ports
];
};
iot = {
allowedTCPPorts = lib.mkForce [
80 # HTTP 1-2
443 # HTTPS 1-2
1704 # snapcast client stream
1705 # snapcast control port
];
allowedUDPPorts = lib.mkForce [
443 # HTTP 3
5353 # mDNS (OTBR / Thread SRP)
];
};
};
};
};
}