summary refs log tree commit diff
path: root/nixos/modules/services/backup/znapzend.nix
blob: 648089f90b7b4a5ff8dce772abbec05174a36acb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.znapzend;
in
{
  options = {
    services.znapzend = {
      enable = mkEnableOption "ZnapZend daemon";
    };
  };

  config = mkIf cfg.enable {
    environment.systemPackages = [ pkgs.znapzend ];

    systemd.services = {
      "znapzend" = {
        description = "ZnapZend - ZFS Backup System";
        after       = [ "zfs.target" ];

        path = with pkgs; [ znapzend zfs mbuffer openssh ];

        script = ''
          znapzend
        '';

        reload = ''
          /bin/kill -HUP $MAINPID
        '';
      };
    };

  };
}