2021-03-30 12:07:20 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2021-04-14 14:09:17 +02:00
|
|
|
let
|
|
|
|
stateDir = "/var/lib/dnsmasq";
|
|
|
|
blocklist = "${stateDir}/dnsmasq.blacklist.txt";
|
|
|
|
|
|
|
|
in {
|
2021-03-30 12:07:20 +02:00
|
|
|
# Pull changes from git repos
|
|
|
|
systemd.user.services.git-pull = {
|
|
|
|
description = "Pull git repositories";
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
path = with pkgs; [ git ];
|
|
|
|
script = ''
|
|
|
|
base_folder=/vault/code
|
|
|
|
cd "$base_folder" || exit
|
|
|
|
ls | xargs -P10 -I{} git -C {} pull --rebase
|
|
|
|
'';
|
2021-04-29 16:48:44 +02:00
|
|
|
serviceConfig.Type = "oneshot";
|
2021-07-30 22:53:58 +02:00
|
|
|
startAt = "22:00:00";
|
2021-03-30 12:07:20 +02:00
|
|
|
};
|
2021-04-07 13:18:49 +02:00
|
|
|
|
|
|
|
# PostgreSQL daily backups
|
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
backupAll = true;
|
|
|
|
location = "/vault/backups/databases/nextcloud";
|
|
|
|
startAt = "*-*-* 05:15:00";
|
|
|
|
};
|
2021-04-14 14:09:17 +02: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";
|
|
|
|
postStop = ''
|
|
|
|
chown -R dnsmasq ${stateDir}
|
|
|
|
systemctl restart dnsmasq
|
|
|
|
'';
|
2021-04-29 16:48:44 +02:00
|
|
|
startAt = "02:00:00";
|
2021-04-14 14:09:17 +02:00
|
|
|
};
|
|
|
|
|
2021-03-30 12:07:20 +02:00
|
|
|
}
|