hosts/hosts/dyndns.nix

43 lines
1.2 KiB
Nix

{ config, pkgs, lib, ... }:
let
definedInPersonalDotNix = lib.mkDefault (throw "Configuration option missing from personal.nix");
getipv6 = pkgs.writeText "getipv6.sh" ''
${pkgs.nettools}/bin/ifconfig enp3s0 | sed -n -E 's/^\ *inet6 (2001(:[0-9a-f]+)+)\ .*$/\1/p'
'';
in
{
networking.tempAddresses = "disabled";
networking.dhcpcd = {
enable = true;
persistent = true;
extraConfig = ''
slaac hwaddr
noipv4ll
interface enp3s0
static ip_address=192.168.178.43/24
static routers=192.168.178.1
static domain_name_servers=192.168.178.1 8.8.8.8
ia_na 1
'';
};
services.ddclient = {
enable = true;
verbose = true;
use = "cmd, cmd='${pkgs.bash}/bin/bash ${getipv6}'";
domains = [
((lib.toLower config.networking.hostName) + ".gvfr.de")
];
ipv6 = true;
server = definedInPersonalDotNix;
username = definedInPersonalDotNix;
passwordFile = "/secrets/dyndns_password_${config.services.ddclient.username}.txt";
extraConfig = ''
wildcard=no
'';
};
}