zion/modules/periodic.nix

59 lines
1.6 KiB
Nix
Raw Normal View History

2020-11-30 02:03:58 +01:00
{ config, lib, pkgs, ... }:
let
2023-12-12 14:56:24 +01:00
stateDir = "/var/lib/dnscrypt-proxy";
blocklist = "${stateDir}/blocklist.txt";
2020-11-30 02:03:58 +01:00
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
# TODO Download the list if the file doesn't exist the first time
2020-11-30 02:03:58 +01:00
systemd.services.download-dns-blocklist = {
description = "Download hosts-blocklists";
wantedBy = [ "default.target" ];
2022-10-23 10:47:58 +02:00
path = with pkgs; [ curl coreutils ];
script = ''
2023-12-12 14:56:24 +01:00
curl -L https://download.dnscrypt.info/blacklists/domains/mybase.txt -o ${blocklist}
2022-10-23 10:47:58 +02:00
'';
serviceConfig.Type = "oneshot";
2021-04-29 16:47:47 +02:00
startAt = "02:00:00";
2020-11-30 02:03:58 +01:00
};
2023-06-08 18:30:16 +02:00
# Enable SATA HAT fans
systemd.services.sata-hat = {
2021-05-15 16:51:46 +02:00
description = "Enable software support for SATA Hat";
2023-06-08 18:30:16 +02:00
wantedBy = [ "default.target" ];
2021-05-15 16:51:46 +02:00
script = ''
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh on"
2022-05-04 19:28:18 +02:00
'';
2021-05-15 16:51:46 +02:00
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
ExecStop = ''
${pkgs.bash}/bin/bash -c "/home/coolneng/system/scripts/SATA-hat.sh off"
'';
2020-11-30 02:03:58 +01:00
};
};
2021-05-24 21:44:00 +02:00
2022-06-07 00:11:57 +02:00
# Push zion changes to git daily
systemd.user.services.zion-push = {
2022-06-07 00:11:57 +02:00
description = "Push zion changes to git";
2022-07-20 10:15:40 +02:00
wantedBy = [ "default.target" ];
2022-06-07 00:11:57 +02:00
path = with pkgs; [ git ];
script = ''
${pkgs.git}/bin/git -C /home/coolneng/system pull
${pkgs.git}/bin/git -C /home/coolneng/system push
'';
2022-06-07 00:11:57 +02:00
serviceConfig.Type = "oneshot";
startAt = "07:00:00";
after = [ "network-online.target" ];
};
2020-11-30 02:03:58 +01:00
}