Replace ddclient with shell script
This commit is contained in:
		
							parent
							
								
									d3f89fee9e
								
							
						
					
					
						commit
						1a543d6067
					
				
					 3 changed files with 101 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -1,9 +1,6 @@
 | 
			
		|||
{ 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'
 | 
			
		||||
    '';
 | 
			
		||||
    interface = "enp3s0";
 | 
			
		||||
in
 | 
			
		||||
{
 | 
			
		||||
    networking.tempAddresses = "disabled";
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +12,7 @@ in
 | 
			
		|||
            slaac hwaddr
 | 
			
		||||
            noipv4ll
 | 
			
		||||
 | 
			
		||||
            interface enp3s0
 | 
			
		||||
            interface ${interface}
 | 
			
		||||
                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
 | 
			
		||||
| 
						 | 
				
			
			@ -24,19 +21,9 @@ in
 | 
			
		|||
        '';
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    services.ddclient = {
 | 
			
		||||
    services.dyndns = {
 | 
			
		||||
        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
 | 
			
		||||
        '';
 | 
			
		||||
        interface = interface;
 | 
			
		||||
        passwordFile = "/secrets/dyndns_password_${config.services.dyndns.username}.txt";
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue