diff --git a/hosts/nuc/backups.nix b/hosts/nuc/backups.nix new file mode 100644 index 0000000..323371d --- /dev/null +++ b/hosts/nuc/backups.nix @@ -0,0 +1,31 @@ +{ + config, + pkgs, + ... +}: let + restic-backup-id = "c351536f-39a4-4725-9d92-04fcb26b6306"; +in { + services.restic.backups = { + daily = { + initialize = true; + + repositoryFile = config.age.secrets."restic/repo".path; + passwordFile = config.age.secrets."restic/password".path; + + user = "emiller"; + paths = [ + "${config.users.users.emiller.home}/sync" + "${config.users.users.emiller.home}/archive" + ]; + + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 5" + "--keep-monthly 12" + ]; + + backupPrepareCommand = "${pkgs.curl}/bin/curl -m 10 --retry 5 https://hc-ping.com/${restic-backup-id}/start"; + backupCleanupCommand = "${pkgs.curl}/bin/curl -m 10 --retry 5 https://hc-ping.com/${restic-backup-id}/$EXIT_STATUS"; + }; + }; +} diff --git a/hosts/nuc/secrets/restic/password.age b/hosts/nuc/secrets/restic/password.age new file mode 100644 index 0000000..bfaa2e6 --- /dev/null +++ b/hosts/nuc/secrets/restic/password.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 qm5Skg So4IAYrzEHUSaEwyTNW+q3TxXYO/g50OiE+WIF9KWRM +1dtjz5VSuEYWUB0mnZLaGwvvrKug1MPWcR79+9w5lz8 +-> ssh-ed25519 md4GBw MgLArUpKU5aMgV0n543y5yAMzJIXUmuG4sLmIbWMwjk +Z4XEVSh1ZDj9EIRKFmTOhtaZFg+9RmRv0Zymz5K/RiY +--- CBzgnwWGPAoo+6ui3qmm4+qfkqlQMv1oaTr8xN24XVw +' VKPpzn6pO!{bCK,Mt@?h \ No newline at end of file diff --git a/hosts/nuc/secrets/restic/repo.age b/hosts/nuc/secrets/restic/repo.age new file mode 100644 index 0000000..9355bc5 --- /dev/null +++ b/hosts/nuc/secrets/restic/repo.age @@ -0,0 +1,8 @@ +age-encryption.org/v1 +-> ssh-ed25519 qm5Skg Bb9kumEly0W4HMvLKB44eeT41T/fPtmBNwHT66J2RyI +wRUofy07Efs3qWYcJ5e7+6qASffq64YKgWmiLFGweWU +-> ssh-ed25519 md4GBw iMYqcCUxTRPuHL6JWMO/DscvFZwGBUEgLRvAQzOOSiY +UqQxLO51Ev+Tct6fLvWr/yQBaeHRizKrpz/qIeg3pmI +--- LGUu2Ezg38k4Xn9EeaukfmZQLBagpVqBEbRea1dlOz8 +A5 +:o.RDAfOKJ+0s!"*{jx,m((2mqTlԂILPB | \ No newline at end of file diff --git a/hosts/nuc/secrets/secrets.nix b/hosts/nuc/secrets/secrets.nix new file mode 100644 index 0000000..b01a9d3 --- /dev/null +++ b/hosts/nuc/secrets/secrets.nix @@ -0,0 +1,7 @@ +let + edmundmiller = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPBsb81evtCCcWSZcLbFaXWrAeCWFrPXPjUvjH4ZKbQC edmundmiller"; + nuc = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICBPG2vvh8XkVObXANO9/CBfczftZrmpbjg2w5onK/Tv"; +in { + "restic/repo.age".publicKeys = [edmundmiller nuc]; + "restic/password.age".publicKeys = [edmundmiller nuc]; +}