summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2019-10-28 09:43:49 +0100
committerGitHub <noreply@github.com>2019-10-28 09:43:49 +0100
commite7a6123a074ce97fefb8eabde2901f5f52b04247 (patch)
treed93aa02983f8d9077732f6754bde2a227e03095b /nixos
parentb27bdf4ec8a02c1c956b15c344069f492b4babc6 (diff)
parentf124b7addcc4925ec58861b2369cd9357d9550bd (diff)
downloadnixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar.gz
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar.bz2
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar.lz
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar.xz
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.tar.zst
nixpkgs-e7a6123a074ce97fefb8eabde2901f5f52b04247.zip
Merge pull request #72080 from Infinisil/znapzend-improvements
Znapzend improvements
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/backup/znapzend.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/services/backup/znapzend.nix b/nixos/modules/services/backup/znapzend.nix
index f317078ddda..203631a577f 100644
--- a/nixos/modules/services/backup/znapzend.nix
+++ b/nixos/modules/services/backup/znapzend.nix
@@ -34,6 +34,8 @@ let
     description = "string of the form number{b|k|M|G}";
   };
 
+  enabledFeatures = concatLists (mapAttrsToList (name: enabled: optional enabled name) cfg.features);
+
   # Type for a string that must contain certain other strings (the list parameter).
   # Note that these would need regex escaping.
   stringContainingStrings = list: let
@@ -354,6 +356,22 @@ in
         '';
         default = false;
       };
+
+      features.recvu = mkEnableOption ''
+        recvu feature which uses <literal>-u</literal> on the receiving end to keep the destination
+        filesystem unmounted.
+      '';
+      features.compressed = mkEnableOption ''
+        compressed feature which adds the options <literal>-Lce</literal> to
+        the <command>zfs send</command> command. When this is enabled, make
+        sure that both the sending and receiving pool have the same relevant
+        features enabled. Using <literal>-c</literal> will skip unneccessary
+        decompress-compress stages, <literal>-L</literal> is for large block
+        support and -e is for embedded data support. see
+        <citerefentry><refentrytitle>znapzend</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+        and <citerefentry><refentrytitle>zfs</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+        for more info.
+      '';
     };
   };
 
@@ -381,12 +399,22 @@ in
         '';
 
         serviceConfig = {
+          # znapzendzetup --import apparently tries to connect to the backup
+          # host 3 times with a timeout of 30 seconds, leading to a startup
+          # delay of >90s when the host is down, which is just above the default
+          # service timeout of 90 seconds. Increase the timeout so it doesn't
+          # make the service fail in that case.
+          TimeoutStartSec = 180;
+          # Needs to have write access to ZFS
+          User = "root";
           ExecStart = let
             args = concatStringsSep " " [
               "--logto=${cfg.logTo}"
               "--loglevel=${cfg.logLevel}"
               (optionalString cfg.noDestroy "--nodestroy")
               (optionalString cfg.autoCreation "--autoCreation")
+              (optionalString (enabledFeatures != [])
+                "--features=${concatStringsSep "," enabledFeatures}")
             ]; in "${pkgs.znapzend}/bin/znapzend ${args}";
           ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
           Restart = "on-failure";