Skip to content

Commit 289a4c6

Browse files
authored
nixos/btrbk: add snapshotOnly option (#369480)
2 parents b70d8b2 + acf701b commit 289a4c6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

doc/manpage-urls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"binfmt.d(5)": "https://www.freedesktop.org/software/systemd/man/binfmt.d.html",
44
"bootctl(1)": "https://www.freedesktop.org/software/systemd/man/bootctl.html",
55
"bootup(7)": "https://www.freedesktop.org/software/systemd/man/bootup.html",
6+
"btrbk(1)": "https://digint.ch/btrbk/doc/btrbk.1.html",
67
"busctl(1)": "https://www.freedesktop.org/software/systemd/man/busctl.html",
78
"cat(1)": "https://www.gnu.org/software/coreutils/manual/html_node/cat-invocation.html",
89
"coredump.conf(5)": "https://www.freedesktop.org/software/systemd/man/coredump.conf.html",

nixos/modules/services/backup/btrbk.nix

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ in
185185
Setting it to null disables the timer, thus this instance can only be started manually.
186186
'';
187187
};
188+
snapshotOnly = mkOption {
189+
type = types.bool;
190+
default = false;
191+
description = ''
192+
Whether to run in snapshot only mode. This skips backup creation and deletion steps.
193+
Useful when you want to manually backup to an external drive that might not always be connected.
194+
Use `btrbk -c /path/to/conf resume` to trigger manual backups.
195+
More examples [here](https://github.com/digint/btrbk#example-backups-to-usb-disk).
196+
See also `snapshot` subcommand in {manpage}`btrbk(1)`.
197+
'';
198+
};
188199
settings = mkOption {
189200
type = types.submodule {
190201
freeformType =
@@ -353,7 +364,9 @@ in
353364
User = "btrbk";
354365
Group = "btrbk";
355366
Type = "oneshot";
356-
ExecStart = "${pkgs.btrbk}/bin/btrbk -c /etc/btrbk/${name}.conf run";
367+
ExecStart = "${pkgs.btrbk}/bin/btrbk -c /etc/btrbk/${name}.conf ${
368+
if instance.snapshotOnly then "snapshot" else "run"
369+
}";
357370
Nice = cfg.niceness;
358371
IOSchedulingClass = cfg.ioSchedulingClass;
359372
StateDirectory = "btrbk";

0 commit comments

Comments
 (0)