Switch to a multihost/home-manager setup
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
script = pkgs.replaceVars ./ddns.sh {
|
||||
bash = pkgs.bash;
|
||||
curl = pkgs.curl;
|
||||
jq = pkgs.jq;
|
||||
};
|
||||
|
||||
cloudflare-ddns = pkgs.writeShellScriptBin "cloudflare-ddns" (builtins.readFile script);
|
||||
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ cloudflare-ddns ];
|
||||
|
||||
systemd.services.cloudflare-ddns = {
|
||||
description = "Cloudflare DDNS updater";
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
|
||||
script = "${cloudflare-ddns}/bin/cloudflare-ddns";
|
||||
};
|
||||
|
||||
systemd.timers.cloudflare-ddns = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
timerConfig = {
|
||||
OnBootSec = "2min";
|
||||
OnUnitActiveSec = "5min";
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/cloudflare-ddns 0750 root root -"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user