summary refs log tree commit diff
path: root/nixos/modules/services/backup
diff options
context:
space:
mode:
authorJoachim Fasting <joachifm@fastmail.fm>2015-04-04 11:48:34 +0200
committerJoachim Fasting <joachifm@fastmail.fm>2015-04-04 12:03:02 +0200
commit66bfc3bbe6b941096c819caa1d4d3cc6170d2df4 (patch)
treea9020674b9c736ccebb0a3e6f78e82371d77b4bd /nixos/modules/services/backup
parent7cb7c57132d65c60af0ded8cfb1d57ae690730e1 (diff)
downloadnixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar.gz
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar.bz2
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar.lz
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar.xz
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.tar.zst
nixlib-66bfc3bbe6b941096c819caa1d4d3cc6170d2df4.zip
tarsnap module: add options for controlling bandwidth
Annoyingly, these do not appear to accept SI prefixes.
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r--nixos/modules/services/backup/tarsnap.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
index 87066b9459f1..f8eeb4378443 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -17,6 +17,9 @@ let
     ${concatStringsSep "\n" (map (v: "include "+v) cfg.includes)}
     ${optionalString cfg.lowmem "lowmem"}
     ${optionalString cfg.verylowmem "verylowmem"}
+    ${optionalString (cfg.maxbw != null) ("maxbw "+toString cfg.maxbw)}
+    ${optionalString (cfg.maxbwRateUp != null) ("maxbw-rate-up "+toString cfg.maxbwRateUp)}
+    ${optionalString (cfg.maxbwRateDown != null) ("maxbw-rate-down "+toString cfg.maxbwRateDown)}
   '';
 in
 {
@@ -164,6 +167,33 @@ in
                   slowing down the archiving process.
                 '';
               };
+
+              maxbw = mkOption {
+                type = types.nullOr types.int;
+                default = null;
+                description = ''
+                  Abort archival if upstream bandwidth usage in bytes
+                  exceeds this threshold.
+                '';
+              };
+
+              maxbwRateUp = mkOption {
+                type = types.nullOr types.int;
+                default = null;
+                example = literalExample "25 * 1000";
+                description = ''
+                  Upload bandwidth rate limit in bytes.
+                '';
+              };
+
+              maxbwRateDown = mkOption {
+                type = types.nullOr types.int;
+                default = null;
+                example = literalExample "50 * 1000";
+                description = ''
+                  Download bandwidth rate limit in bytes.
+                '';
+              };
             };
           }
         ));