zion/modules/periodic.nix

35 lines
852 B
Nix
Raw Normal View History

2020-11-30 02:03:58 +01:00
{ config, lib, pkgs, ... }:
let
stateDir = "/var/lib/dnsmasq";
blocklist = "${stateDir}/dnsmasq.blacklist.txt";
in {
# PostgreSQL daily backups
services.postgresqlBackup = {
enable = true;
backupAll = true;
location = "/vault/backups/zion/databases";
startAt = "*-*-* 05:15:00";
};
2020-11-30 02:03:58 +01:00
# Fetch hosts-blocklists daily
systemd.services.download-dns-blocklist = {
description = "Download hosts-blocklists";
wantedBy = [ "default.target" ];
path = with pkgs; [ curl ];
script =
"curl -L https://github.com/notracking/hosts-blocklists/raw/master/dnsmasq/dnsmasq.blacklist.txt -o ${blocklist}";
serviceConfig.Type = "oneshot";
2020-11-30 02:03:58 +01:00
postStop = ''
chown -R dnsmasq ${stateDir}
systemctl restart dnsmasq
'';
2021-04-29 16:47:47 +02:00
startAt = "02:00:00";
2020-11-30 02:03:58 +01:00
};
wantedBy = [ "default.target" ];
};
};
}