Skip to content

Commit f5fe29d

Browse files
committed
local borg backups
1 parent 448296e commit f5fe29d

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

nix/configuration.nix

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,26 @@
257257
_ _ @ltab _ @ltab _ _ _ _ _
258258
)
259259
'';
260+
baseBorg = {
261+
repo = "/mnt/backup/borg";
262+
user = config.services.functora.userName;
263+
doInit = true;
264+
startAt = "daily";
265+
compression = "auto,lzma";
266+
encryption.mode = "none";
267+
prune.keep = {
268+
daily = 7;
269+
weekly = 4;
270+
monthly = 3;
271+
};
272+
};
273+
mkLocalBorg = cfg: {
274+
"local-${cfg.name}" =
275+
baseBorg
276+
// {
277+
paths = cfg.paths;
278+
};
279+
};
260280
in {
261281
imports =
262282
[
@@ -281,6 +301,17 @@ in {
281301
type = types.bool;
282302
default = true;
283303
};
304+
localBorg = mkOption {
305+
type = types.listOf (types.submodule {
306+
options.name = mkOption {
307+
type = types.str;
308+
};
309+
options.paths = mkOption {
310+
type = types.listOf types.str;
311+
};
312+
});
313+
default = [];
314+
};
284315
};
285316

286317
config = rec {
@@ -915,5 +946,11 @@ in {
915946
displayManager.defaultSession = "sway";
916947
displayManager.sessionPackages = [pkgs.sway];
917948
};
949+
#
950+
# Borg
951+
#
952+
services.borgbackup.jobs =
953+
lib.mkMerge
954+
(map mkLocalBorg config.services.functora.localBorg);
918955
};
919956
}

prv

Submodule prv updated from d19a813 to c43eaef

0 commit comments

Comments
 (0)