os/hosts/pie/ddclient.nix

41 lines
879 B
Nix

{
flake,
config,
pkgs,
lib,
...
}:
with lib; let
psCfg = config.pub-solar;
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
getIP6 = with pkgs; writeShellScriptBin "getIP" ''
${curl}/bin/curl -6 https://ipcheck-ds.wieistmeineip.de/callback/ | ${coreutils}/bin/tail -c +2 | ${coreutils}/bin/head -c -1 | ${jq}/bin/jq '.ip' -r
'';
in {
imports = [
flake.self.nixosModules.ddclient
];
services.ddclient = {
enable = true;
protocol = "dyndns1";
domains = [
"pie.b12f.io"
"droppie.b12f.io"
];
server = "ddns.hosting.de";
username = "b12f";
usev6 = "cmdv6, cmdv6=${getIP6}/bin/getIP";
verbose = true;
passwordFile = "/run/agenix/dyndns.key";
interval = "1min";
};
age.secrets."dyndns.key" = {
file = "${flake.self}/secrets/dyndns.key";
mode = "400";
owner = "root";
};
}