hikari3: Setup auto backups via borg

Add one for work (projects) and one for home.
This commit is contained in:
Daniel Siepmann 2024-06-14 20:18:44 +02:00
parent 988182e974
commit 71328adc93
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -88,6 +88,98 @@
enable = true;
user = "daniels";
};
borgbackup.jobs = {
# TODO: Add another "systemBackup" job, see: https://discourse.nixos.org/t/nixos-server-what-to-backup/25547/6
projectBackup = {
paths = "/var/projects/";
user = "daniels";
group = "users";
repo = "/run/media/daniels/TimeMachine/Projects";
removableDevice = true;
doInit = false;
exclude = [
"*/node_modules/*"
"*/typo3temp/*"
"*/var/cache/*"
];
prune = {
keep = {
within = "1d";
weekly = 4;
monthly = 2;
};
};
compression = "auto,lzma";
startAt = "*:0/15";
encryption = {
mode = "repokey";
passCommand = "${pkgs.libsecret}/bin/secret-tool lookup password borgbackup.timemachine.projects";
};
environment = {
DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/1000/bus";
};
};
danielsHomeBackup = {
paths = "/home/daniels/";
user = "daniels";
group = "users";
repo = "/run/media/daniels/TimeMachine/DanielsHome";
removableDevice = true;
doInit = false;
exclude = [
"/home/daniels/.cache"
"/home/daniels/.config/chromium"
"/home/daniels/.dbus"
"/home/daniels/.gvfs"
"/home/daniels/.icons"
"/home/daniels/.java"
"/home/daniels/.local/bin"
"/home/daniels/.local/lib"
"/home/daniels/.local/share/vim/"
"/home/daniels/.local/share/icons/"
"/home/daniels/.local/share/mime/"
"/home/daniels/.local/share/containers/"
"/home/daniels/.local/state"
"/home/daniels/.mozilla"
"/home/daniels/.nix-profile/"
"/home/daniels/.node"
"/home/daniels/.npm"
"/home/daniels/.node-gyp"
"/home/daniels/.rnd"
"/home/daniels/Downloads/"
"/home/daniels/Music/"
];
prune = {
keep = {
within = "2d";
weekly = 4;
monthly = 6;
};
};
compression = "auto,lzma";
startAt = "*:0/15";
encryption = {
mode = "repokey";
passCommand = "${pkgs.libsecret}/bin/secret-tool lookup password borgbackup.timemachine.danielsHome";
};
environment = {
DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/1000/bus";
};
};
};
};
# Enable sound with pipewire.