From 123b167ef56e72472d467c1cb71d3c8225d8a7e9 Mon Sep 17 00:00:00 2001 From: Anish L Date: Tue, 14 Jun 2022 16:05:12 +1000 Subject: [PATCH] key the file saved and add it to hosts that need backup --- hosts/box/default.nix | 4 +++- modules/backup.nix | 4 ++-- profiles/backup/default.nix | 35 +---------------------------------- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/hosts/box/default.nix b/hosts/box/default.nix index c2ac2a65..cd138a44 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -1,4 +1,4 @@ -{ profiles, suites, ... }: +{ self, profiles, suites, ... }: { imports = [ ./configuration.nix @@ -13,6 +13,8 @@ services."grasp".path = "/home/anish/kitaab/grasp"; services."grasp".user = "anish"; + age.secrets.borg-password.file = "${self}/secrets/borg-password.age"; + services.postgresqlBackup = { enable = true; databases = [ "wallabag" ]; diff --git a/modules/backup.nix b/modules/backup.nix index eabdc1b3..ca3cbe5c 100644 --- a/modules/backup.nix +++ b/modules/backup.nix @@ -22,7 +22,7 @@ in ''; }; paths = lib.mkOption { - type = with types; attrsOf (listOf str); + type = with types; listOf str; default = { }; example = literalExample '' [ "/home/anish/usr" ]; @@ -46,7 +46,7 @@ in }; environment = { BORG_RSH = "ssh -i /root/borg/borg-key"; }; # YOU NEED TO PUT THIS HERE MANUALLY compression = "auto,lzma"; - startAt = "weekly"; + startAt = "daily"; extraArgs = "--remote-path=borg1"; }; }; diff --git a/profiles/backup/default.nix b/profiles/backup/default.nix index ee9ecb43..ffcd4415 100644 --- a/profiles/backup/default.nix +++ b/profiles/backup/default.nix @@ -1,34 +1 @@ -{ - # Assumes the remote borg backup server has already been initialized - # borg init --encryption-key=repokey-blake2 -rsh 'ssh -i /run/keys/id_ed25519_borgbase' 20779@hk-s020.rsync.net: - services.borgbackup.jobs = { - backupTaskwarriorRsync = { - paths = [ "/var/lib/taskserver" ]; - doInit = true; - repo = "20779@hk-s020.rsync.net:taskwarrior"; - encryption = { - mode = "repokey-blake2"; - passCommand = "cat /run/keys/rsync"; - }; - environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; }; - compression = "auto,lzma"; - startAt = "weekly"; - extraArgs = "--remote-path=borg1"; - }; - }; - services.borgbackup.jobs = { - backupShaarliRsync = { - paths = [ "/var/www/shaarli-config/data/datastore.php" "/var/www/shaarli-config/config" "/var/www/shaarli-config/.json.config" ]; - doInit = true; - repo = "20779@hk-s020.rsync.net:shaarli"; - encryption = { - mode = "repokey-blake2"; - passCommand = "cat /run/keys/rsync"; - }; - environment = { BORG_RSH = "ssh -i /run/keys/id_ed25519_borgbase"; }; - compression = "auto,lzma"; - startAt = "weekly"; - extraArgs = "--remote-path=borg1"; - }; - }; -} +{ }