{ 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.interfaces.enp3s0 = {
    #     tempAddress = "disabled";
    #     ipv4.addresses = [{
    #         address = "192.168.178.43";
    #         prefixLength = 24;
    #     }];
    # };
    networking.defaultGateway = "192.168.178.1";
    networking.nameservers = [ "9.9.9.9" "8.8.8.8" ];

    networking.dhcpcd = {
        enable = true;
        persistent = true;
        extraConfig = ''
            duid
            vendorclassid
            slaac hwaddr
            noipv4ll
            #ia_pd 1 internal

            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_pd
        '';
    };

    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
        '';
    };
}
