diff --git a/nixos/borgbackup.nix b/nixos/borgbackup.nix new file mode 100644 index 0000000..86ac43a --- /dev/null +++ b/nixos/borgbackup.nix @@ -0,0 +1,37 @@ +{ + services.borgbackup.jobs."borgbase" = { + paths = [ + # server storage + "/var/lib/postgresql" + "/var/lib/sourcehut" + # user storage + "/home" + ]; + exclude = [ + # remote mounted folders + "/home/khais/Music" + "/home/khais/Books" + # scratch directories + "/home/*/Downloads" + "/home/*/.local" + # cache & trash directories + "**/*cache" + "**/*Cache" + "**/*trash" + "**/*Trash" + # already cloud apps + "**/.mozilla/firefox" + # build-output directories + "**/target" + "**/result" + ]; + repo = "lni0x30f@lni0x30f.repo.borgbase.com:repo"; + encryption = { + mode = "repokey-blake2"; + passCommand = "cat /root/borgbackup/passphrase"; + }; + environment.BORG_RSH = "ssh -i /root/borgbackup/ssh_key"; + compression = "auto,lzma"; + startAt = "daily"; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 27e30e6..d679cf1 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -8,6 +8,7 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix ./sourcehut.nix + ./borgbackup.nix ]; # Bootloader.