key the file saved and add it to hosts that need backup

This commit is contained in:
Anish L 2022-06-14 16:05:12 +10:00
parent 36d1d1c61e
commit 123b167ef5
3 changed files with 6 additions and 37 deletions

View file

@ -1,4 +1,4 @@
{ profiles, suites, ... }: { self, profiles, suites, ... }:
{ {
imports = [ imports = [
./configuration.nix ./configuration.nix
@ -13,6 +13,8 @@
services."grasp".path = "/home/anish/kitaab/grasp"; services."grasp".path = "/home/anish/kitaab/grasp";
services."grasp".user = "anish"; services."grasp".user = "anish";
age.secrets.borg-password.file = "${self}/secrets/borg-password.age";
services.postgresqlBackup = { services.postgresqlBackup = {
enable = true; enable = true;
databases = [ "wallabag" ]; databases = [ "wallabag" ];

View file

@ -22,7 +22,7 @@ in
''; '';
}; };
paths = lib.mkOption { paths = lib.mkOption {
type = with types; attrsOf (listOf str); type = with types; listOf str;
default = { }; default = { };
example = literalExample '' example = literalExample ''
[ "/home/anish/usr" ]; [ "/home/anish/usr" ];
@ -46,7 +46,7 @@ in
}; };
environment = { BORG_RSH = "ssh -i /root/borg/borg-key"; }; # YOU NEED TO PUT THIS HERE MANUALLY environment = { BORG_RSH = "ssh -i /root/borg/borg-key"; }; # YOU NEED TO PUT THIS HERE MANUALLY
compression = "auto,lzma"; compression = "auto,lzma";
startAt = "weekly"; startAt = "daily";
extraArgs = "--remote-path=borg1"; extraArgs = "--remote-path=borg1";
}; };
}; };

View file

@ -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:<borg-archive>
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";
};
};
}