2022-09-27 22:20:53 +05:30
|
|
|
{ config, pkgs, lib, ... }:
|
2022-09-27 13:08:52 +05:30
|
|
|
|
2022-10-01 12:13:38 +05:30
|
|
|
let
|
|
|
|
binPath = "${pkgs.coreutils-full}/bin";
|
|
|
|
dyndns-updater-script = pkgs.writeScript "dyndns-updater" ''
|
|
|
|
#!${pkgs.bash}/bin/bash
|
|
|
|
export CLOUDFLARE_API_TOKEN=`${binPath}/cat ${config.xdg.configHome}/.cloudflare_dns_updater_api_token`
|
|
|
|
${binPath}/echo && ${binPath}/date
|
|
|
|
${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns --debug home.abhinavsarkar.net
|
|
|
|
'';
|
2022-09-27 22:20:53 +05:30
|
|
|
in {
|
|
|
|
launchd.agents.dyndns-updater = lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
|
2022-09-27 13:08:52 +05:30
|
|
|
enable = true;
|
|
|
|
config = {
|
2022-10-01 12:13:38 +05:30
|
|
|
Program = "${dyndns-updater-script}";
|
2022-09-27 22:20:53 +05:30
|
|
|
StandardErrorPath = "/tmp/hm-dyndns-updater.log";
|
|
|
|
StandardOutPath = "/tmp/hm-dyndns-updater.log";
|
2022-09-27 13:08:52 +05:30
|
|
|
StartInterval = 600;
|
|
|
|
ProcessType = "Background";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|