1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 07:04:28 +00:00
nixpkgs/nixos/modules/services/backup/znapzend.nix

55 lines
1.5 KiB
Nix
Raw Normal View History

2016-03-24 09:52:13 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.znapzend;
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::<facility> or <filepath>).";
};
noDestroy = mkOption {
type = types.bool;
default = false;
description = "Does all changes to the filesystem except destroy";
};
2016-03-24 09:52:13 +00:00
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.znapzend ];
systemd.services = {
"znapzend" = {
description = "ZnapZend - ZFS Backup System";
2017-05-15 14:09:50 +01:00
wantedBy = [ "zfs.target" ];
2016-03-24 09:52:13 +00:00
after = [ "zfs.target" ];
path = with pkgs; [ zfs mbuffer openssh ];
2016-03-24 09:52:13 +00:00
serviceConfig = {
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";
};
2016-03-24 09:52:13 +00:00
};
};
};
}