Move backup to Hetzner's storage box

This commit is contained in:
Paul-Henri Froidmont 2023-04-22 02:46:55 +02:00
parent 8c4e559348
commit ff0abf6309
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
4 changed files with 32 additions and 18 deletions

View file

@ -1,9 +1,7 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.custom.services.backup-job;
in
{
let cfg = config.custom.services.backup-job;
in {
options.custom.services.backup-job = {
enable = mkEnableOption "backup-job";
@ -12,6 +10,13 @@ in
default = [ ];
};
patterns = mkOption {
type = with types; listOf str;
default = [ ];
};
repoName = mkOption { type = types.str; };
readWritePaths = mkOption {
type = with types; listOf path;
default = [ ];
@ -36,9 +41,7 @@ in
default = "03:30";
};
sshKey = mkOption {
type = with types; path;
};
sshKey = mkOption { type = with types; path; };
};
config = mkIf cfg.enable {
@ -52,8 +55,10 @@ in
services.borgbackup.jobs.data = {
paths = [ "/nix/var/data" cfg.sshKey ] ++ cfg.additionalPaths;
patterns = cfg.patterns;
doInit = false;
repo = "borgbackup@212.129.12.205:./";
repo =
"ssh://u348077@u348077.your-storagebox.de:23/home/repos/${cfg.repoName}";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets.borgPassphrase.path}";