summary refs log tree commit diff
path: root/nixos/modules/services/backup
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2017-05-21 12:57:16 +0200
committerJörg Thalheim <joerg@thalheim.io>2017-05-22 21:47:51 +0100
commit3497ba5c3a994379cca9bf44ba832cc66576fb58 (patch)
tree65a5421dda552f1c55d5682fbd93ac02b2e6a16e /nixos/modules/services/backup
parent31a5e065b06d0f65e6a5a5b2a9ac9a6e7164daef (diff)
downloadnixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar.gz
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar.bz2
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar.lz
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar.xz
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.tar.zst
nixpkgs-3497ba5c3a994379cca9bf44ba832cc66576fb58.zip
znapzend service: options for logging/nodestroy/restart on failure
fixes #25960
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r--nixos/modules/services/backup/znapzend.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/nixos/modules/services/backup/znapzend.nix b/nixos/modules/services/backup/znapzend.nix
index a980ac1b3b0..8c5af80c8fb 100644
--- a/nixos/modules/services/backup/znapzend.nix
+++ b/nixos/modules/services/backup/znapzend.nix
@@ -9,6 +9,26 @@ in
   options = {
     services.znapzend = {
       enable = mkEnableOption "ZnapZend daemon";
+
+      logLevel = mkOption {
+        default = "debug";
+        example = "warning";
+        type = lib.types.enum ["debug" "info" "warning" "err" "alert"];
+        description = "The log level when logging to file. Any of debug, info, warning, err, alert. Default in daemonized form is debug.";
+      };
+
+      logTo = mkOption {
+        type = types.str;
+        default = "syslog::daemon";
+        example = "/var/log/znapzend.log";
+        description = "Where to log to (syslog::&lt;facility&gt; or &lt;filepath&gt;).";
+      };
+
+      noDestroy = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Does all changes to the filesystem except destroy";
+      };
     };
   };
 
@@ -24,8 +44,9 @@ in
         path = with pkgs; [ zfs mbuffer openssh ];
 
         serviceConfig = {
-          ExecStart = "${pkgs.znapzend}/bin/znapzend";
+          ExecStart = "${pkgs.znapzend}/bin/znapzend --logto=${cfg.logTo} --loglevel=${cfg.logLevel} ${optionalString cfg.noDestroy "--nodestroy"}";
           ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
+          Restart = "on-failure";
         };
       };
     };