From db1e3dcdc69657867245fbc9a9e65e0f30579eaa Mon Sep 17 00:00:00 2001 From: Fabian Montero Date: Tue, 26 Aug 2025 02:34:20 -0600 Subject: [PATCH] config: add borg backups --- sys/platforms/posixlycorrect/borg.nix | 46 ++++++++++++++++++++++++ sys/platforms/posixlycorrect/default.nix | 1 + 2 files changed, 47 insertions(+) create mode 100644 sys/platforms/posixlycorrect/borg.nix diff --git a/sys/platforms/posixlycorrect/borg.nix b/sys/platforms/posixlycorrect/borg.nix new file mode 100644 index 0000000..21de2e8 --- /dev/null +++ b/sys/platforms/posixlycorrect/borg.nix @@ -0,0 +1,46 @@ +{ + config, + pkgs, + lib, + flakes, + ... +}: { + services.borgbackup.jobs = { + rsync = { + paths = [ + "/home/fabian/nix" + ]; + exclude = [ + ]; + user = "root"; + group = "root"; + doInit = true; + startAt = [ + "hourly" + ]; + inhibitsSleep = true; + persistentTimer = true; + + repo = "zh5777@zh5777.rsync.net:posixlycorrect"; + encryption = { + mode = "repokey-blake2"; + passCommand = "cat /var/trust/borg/posixlycorrect_passphrase"; + }; + compression = "auto,lz4"; + prune = { + keep = { + hourly = 24; + daily = 7; + weekly = 4; + monthly = 12; + yearly = 99; + }; + }; + extraArgs = [ + "--remote-path=borg14" + ]; + }; + }; + + environment.sessionVariables.BORG_REMOTE_PATH = "borg14"; +} diff --git a/sys/platforms/posixlycorrect/default.nix b/sys/platforms/posixlycorrect/default.nix index eeca950..64436d6 100644 --- a/sys/platforms/posixlycorrect/default.nix +++ b/sys/platforms/posixlycorrect/default.nix @@ -9,6 +9,7 @@ flakes.home-manager.nixosModules.home-manager flakes.impermanence.nixosModule ./hardware-configuration.nix + ./borg.nix ]; local.sys = {