2024-03-31 22:04:51 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
vars = import ../../vars.nix;
|
|
|
|
arionPath = "/home/${vars.user}/.setup/hosts/franz/arion";
|
2024-04-03 11:25:20 +02:00
|
|
|
cfg = config.virtualisation.arion;
|
2024-03-31 22:04:51 +02:00
|
|
|
in {
|
2024-04-03 11:25:20 +02:00
|
|
|
# systemd.timers."restic-cron" = {
|
|
|
|
# wantedBy = ["timers.target"];
|
|
|
|
# timerConfig = {
|
|
|
|
# OnBootSec = "1m";
|
|
|
|
# OnUnitActiveSec = "1m";
|
|
|
|
# Unit = "restic-cron.service";
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
#
|
|
|
|
# systemd.services."restic-cron" = {
|
|
|
|
# path = [
|
|
|
|
# cfg.docker.client.package
|
|
|
|
# cfg.package
|
|
|
|
# pkgs.nix
|
|
|
|
# pkgs.restic
|
|
|
|
# pkgs.autorestic
|
|
|
|
# ];
|
|
|
|
# script = ''
|
|
|
|
# source /etc/profile
|
|
|
|
# autorestic -c /home/ghoscht/.autorestic.yml --verbose cron >> /tmp/autorestic.log 2>&1
|
|
|
|
# '';
|
|
|
|
# serviceConfig = {
|
|
|
|
# Type = "oneshot";
|
|
|
|
# User = "root";
|
|
|
|
# };
|
|
|
|
# };
|
2024-03-31 22:04:51 +02:00
|
|
|
|
2024-04-03 11:25:20 +02:00
|
|
|
services.cron = {
|
|
|
|
enable = true;
|
|
|
|
systemCronJobs = [
|
|
|
|
"*/5 * * * * root . /etc/profile; autorestic -c /home/ghoscht/.autorestic.yml --ci cron"
|
|
|
|
];
|
2024-03-31 22:04:51 +02:00
|
|
|
};
|
2024-04-03 11:25:20 +02:00
|
|
|
|
2024-03-31 22:04:51 +02:00
|
|
|
environment.systemPackages = with pkgs; [autorestic restic];
|
|
|
|
|
|
|
|
sops.secrets."autorestic/zfs_key" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
|
|
|
sops.secrets."autorestic/ssd_key" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
|
|
|
|
|
|
|
sops.templates.".autorestic.yml" = {
|
|
|
|
path = "/home/${vars.user}/.autorestic.yml";
|
|
|
|
owner = vars.user;
|
|
|
|
mode = "0775";
|
|
|
|
content = ''
|
|
|
|
version: 2
|
|
|
|
global:
|
|
|
|
forget:
|
|
|
|
keep-weekly: 7
|
|
|
|
keep-monthly: 12
|
|
|
|
locations:
|
|
|
|
dashboard:
|
|
|
|
from: /storage/dataset/docker/dashboard
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
cron: '0 3 * * 0' # Every Sunday at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
dns:
|
|
|
|
from: /storage/dataset/docker/dns
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
cron: '0 3 * * 0' # Every Sunday at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
feed:
|
|
|
|
from: /storage/dataset/docker/feed
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
cron: '0 3 * * 0' # Every Sunday at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
git:
|
|
|
|
from: /storage/dataset/docker/git
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
cron: '0 3 * * *' # Every Day at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
media:
|
|
|
|
from: /storage/dataset/docker/media
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-04-03 11:25:20 +02:00
|
|
|
cron: '0 3 * * *' # Every Day at 3:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
nextcloud:
|
|
|
|
from: /storage/dataset/docker/nextcloud
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
cron: '0 3 * * *' # Every Day at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
smarthome:
|
|
|
|
from: /storage/dataset/docker/smarthome
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
cron: '0 3 * * 0' # Every Sunday at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
passwords:
|
|
|
|
from: /storage/dataset/docker/passwords
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
cron: '0 3 * * *' # Every Day at 3:00
|
|
|
|
hooks:
|
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
backends:
|
|
|
|
zfs:
|
|
|
|
type: local
|
|
|
|
path: /storage/dataset/backups
|
|
|
|
key: '${config.sops.placeholder."autorestic/zfs_key"}'
|
|
|
|
ssd:
|
|
|
|
type: local
|
|
|
|
path: /home/ghoscht/Backups
|
|
|
|
key: '${config.sops.placeholder."autorestic/ssd_key"}'
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|