1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00
mdlayher-homelab/nixos/routnerr-2/corerad.nix
Matt Layher 0d6b295a1e
nixos/routnerr-2: move router configs to subdirectory
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-04-22 10:13:52 -04:00

55 lines
1.3 KiB
Nix

{ config, lib, pkgs, ... }:
let
vars = import ./vars.nix;
unstable = import <unstable> { };
guest0 = vars.interfaces.guest0;
iot0 = vars.interfaces.iot0;
lab0 = vars.interfaces.lab0;
lan0 = vars.interfaces.lan0;
in {
services.corerad = {
enable = true;
# Use unstable package until CoreRAD v0.2.4 lands in 20.03 stable.
package = unstable.corerad;
configFile = pkgs.writeText "corerad.toml" ''
# CoreRAD v0.2.4 (BETA) configuration file.
[debug]
address = ":9430"
prometheus = true
pprof = true
${lib.concatMapStrings (ifi: ''
[[interfaces]]
name = "${ifi.name}"
advertise = true
other_config = true
${
# Treat the primary LAN as higher priority for machines on multiple LANs.
if ifi.name == lan0.name then ''
preference = "high"
'' else
""}
[[interfaces.prefix]]
prefix = "::/64"
[[interfaces.rdnss]]
servers = ["${ifi.ipv6.ula}"]
${
# Configure DNS search for the primary internal LAN.
if ifi.internal_domain then ''
[[interfaces.dnssl]]
domain_names = ["${vars.domain}"]
'' else
""
}
'') [ lan0 guest0 iot0 lab0 ]}
'';
};
}