feat(home-server): switch from ddclient to inadyn

ddclient was removed in NixOS unstable (both the package & the module)
and it is not much maintained upstream.
Also sets up IPv4 record updates.
This commit is contained in:
Felix Schröter 2023-10-04 19:46:50 +02:00
parent 60b721fc6d
commit 8e45802f4c
Signed by: felschr
GPG key ID: 671E39E6744C807D

View file

@ -16,6 +16,7 @@ in with builtins; {
../system/server.nix ../system/server.nix
../virtualisation/containers.nix ../virtualisation/containers.nix
../virtualisation/podman.nix ../virtualisation/podman.nix
../modules/inadyn.nix
../modules/systemdNotify.nix ../modules/systemdNotify.nix
../services/mail.nix ../services/mail.nix
../services/restic/home-server.nix ../services/restic/home-server.nix
@ -49,36 +50,25 @@ in with builtins; {
security.acme.acceptTerms = true; security.acme.acceptTerms = true;
security.acme.defaults.email = "dev@felschr.com"; security.acme.defaults.email = "dev@felschr.com";
services.ddclient = { services.inadyn.enable = true;
enable = true; services.inadyn.provider = "cloudflare.com";
package = pkgs.ddclient.overrideAttrs (old: rec { services.inadyn.username = "felschr.com";
version = "develop-2022-06-01"; services.inadyn.passwordFile = config.age.secrets.cloudflare.path;
src = pkgs.fetchFromGitHub { services.inadyn.extraConfig = ''
owner = "ddclient"; proxied = false
repo = "ddclient";
rev = "5382a982cbf4ad8e0c7b7ff682d21554a8785285";
sha256 = "sha256-LYQ65f1rLa1P/YNhrW7lbyhmViPO7odj7FcDGTS4bOo=";
};
preConfigure = ''
touch Makefile.PL
''; '';
installPhase = ""; services.inadyn.ipv4.enable = true;
postInstall = old.postInstall or "" + '' services.inadyn.ipv4.command = "${pkgs.writeScript "get-ipv4" ''
mv $out/bin/ddclient $out/bin/.ddclient /run/wrappers/bin/mullvad-exclude \
makeWrapper $out/bin/.ddclient $out/bin/ddclient \ ${pkgs.curl}/bin/curl -4 -s --retry 10 ifconfig.co
--prefix PERL5LIB : $PERL5LIB \ ''}";
--argv0 ddclient services.inadyn.ipv6.enable = true;
''; services.inadyn.ipv6.command = "${pkgs.writeScript "get-ipv6" ''
nativeBuildInputs = with pkgs; ${pkgs.iproute2}/bin/ip -6 --brief addr show enp2s0 mngtmpaddr \
old.nativeBuildInputs or [ ] ++ [ autoreconfHook makeWrapper ]; | ${pkgs.gawk}/bin/awk '{print $3}' \
}); | cut -f1 -d'/'
protocol = "cloudflare"; ''}";
ssl = true; services.inadyn.domains = [
use = "disabled";
zone = "felschr.com";
username = "felschr@pm.me";
passwordFile = config.age.secrets.cloudflare.path;
domains = [
"felschr.com" "felschr.com"
"openpgpkey.felschr.com" "openpgpkey.felschr.com"
"home.felschr.com" "home.felschr.com"
@ -95,17 +85,6 @@ in with builtins; {
"paperless.felschr.com" "paperless.felschr.com"
"boards.felschr.com" "boards.felschr.com"
]; ];
extraConfig = with pkgs; ''
usev6=cmdv6, cmdv6=${
pkgs.writeScript "get-ipv6" ''
${iproute2}/bin/ip -6 --brief addr show enp2s0 mngtmpaddr \
| ${gawk}/bin/awk '{print $3}' \
| cut -f1 -d'/'
''
}
usev4=disabled
'';
};
services.nginx = { services.nginx = {
enable = true; enable = true;