2023-10-08 17:32:00 +00:00
|
|
|
{
|
|
|
|
flake,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
psCfg = config.pub-solar;
|
|
|
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
|
|
|
|
2023-10-24 13:54:18 +00:00
|
|
|
getIP4 = with pkgs; writeShellScriptBin "getIP" ''
|
|
|
|
${curl}/bin/curl -4 https://ipcheck-ds.wieistmeineip.de/callback/ | ${coreutils}/bin/tail -c +2 | ${coreutils}/bin/head -c -1 | ${jq}/bin/jq '.ip' -r
|
|
|
|
'';
|
2023-10-08 17:32:00 +00:00
|
|
|
getIP6 = with pkgs; writeShellScriptBin "getIP" ''
|
2023-10-25 11:23:13 +00:00
|
|
|
echo "2a02:908:5b1:e3c0:3077:2::"
|
2023-10-08 17:32:00 +00:00
|
|
|
'';
|
|
|
|
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";
|
2023-10-24 13:54:18 +00:00
|
|
|
usev4 = "cmdv4, cmdv4=${getIP4}/bin/getIP";
|
2023-10-08 17:32:00 +00:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
}
|