Skip to content

Commit

Permalink
nixos/btrbk: add snapshotOnly option
Browse files Browse the repository at this point in the history
  • Loading branch information
cything committed Dec 30, 2024
1 parent c0851de commit a37b9ee
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion nixos/modules/services/backup/btrbk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,17 @@ in
Setting it to null disables the timer, thus this instance can only be started manually.
'';
};
snapshotOnly = mkOption {
type = types.bool;
default = false;
description = ''
Whether to run in snapshot only mode. This skips backup creation and deletion steps.
Useful when you want to manually backup to an external drive that might not always be connected.
Use `btrbk -c /path/to/conf resume` to trigger manual backups.
More examples [here](https://github.com/digint/btrbk#example-backups-to-usb-disk).
See also `snapshot` subcommand in {manpage}`btrbk(1)`.
'';
};
settings = mkOption {
type = types.submodule {
freeformType =
Expand Down Expand Up @@ -353,7 +364,9 @@ in
User = "btrbk";
Group = "btrbk";
Type = "oneshot";
ExecStart = "${pkgs.btrbk}/bin/btrbk -c /etc/btrbk/${name}.conf run";
ExecStart = "${pkgs.btrbk}/bin/btrbk -c /etc/btrbk/${name}.conf ${
if instance.snapshotOnly then "snapshot" else "run"
}";
Nice = cfg.niceness;
IOSchedulingClass = cfg.ioSchedulingClass;
StateDirectory = "btrbk";
Expand Down

0 comments on commit a37b9ee

Please sign in to comment.