From 3b5ab82fa714a0d483a7b90d60f9f7c857646e33 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 2 Jan 2021 21:44:21 +0100 Subject: sif: borgbackup --- hosts/sif/default.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'hosts/sif') diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index 4e9826bd..9271515f 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix @@ -1,4 +1,4 @@ -{ flake, pkgs, customUtils, lib, config, ... }: +{ flake, pkgs, customUtils, lib, config, path, ... }: { imports = with flake.nixosModules.systemProfiles; [ ./hw.nix @@ -259,6 +259,30 @@ SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="${systemd}/bin/systemctl --no-block start ac-plugged.service" ''; + services.borgbackup = { + snapshots = "btrfs"; + prefix = "yggdrasil.midgard.sif."; + targets = { + "munin" = { + repo = "borg.munin:borg"; + paths = [ "/home/gkleen" ]; + prune = { + "home" = + [ "--keep-within" "24H" + "--keep-daily" "31" + "--keep-monthly" "12" + "--keep-yearly" "-1" + ]; + }; + keyFile = "/run/secrets/borg-repokey--borg_munin__borg"; + }; + }; + }; + sops.secrets.borg-repokey--borg_munin__borg = { + sopsFile = /. + path + "/modules/borgbackup/repokeys/borg_munin__borg.yaml"; + key = "key"; + }; + services.btrfs.autoScrub = { enable = true; fileSystems = [ "/" "/home" ]; -- cgit v1.2.3