From 698dfed2e629a4d1bd0a0f7348071d32b5c41639 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sun, 27 Oct 2019 12:06:18 +0100 Subject: [PATCH] nixos/znapzend: Add options for features --- nixos/modules/services/backup/znapzend.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nixos/modules/services/backup/znapzend.nix b/nixos/modules/services/backup/znapzend.nix index f317078ddda..18743752abc 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 -u on the receiving end to keep the destination + filesystem unmounted. + ''; + features.compressed = mkEnableOption '' + compressed feature which adds the options -Lce to + the zfs send command. When this is enabled, make + sure that both the sending and receiving pool have the same relevant + features enabled. Using -c will skip unneccessary + decompress-compress stages, -L is for large block + support and -e is for embedded data support. see + znapzend1 + and zfs8 + for more info. + ''; }; }; @@ -387,6 +405,8 @@ in "--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";