1
0
Fork 0
mirror of https://github.com/mdlayher/homelab.git synced 2024-12-14 11:47:32 +00:00
mdlayher-homelab/nixos/lib/modules/zedhook.nix
Matt Layher 391cfc0de0
nixos/lib: zedhookd bump
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2022-05-03 13:00:31 -04:00

49 lines
1.3 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.zedhook;
in {
options.services.zedhook = {
enable = mkEnableOption "zedhook ZFS event monitoring system";
package = mkOption {
default = pkgs.zedhook;
defaultText = "pkgs.zedhook";
type = types.package;
description = "zedhook package to use.";
};
};
config = mkIf cfg.enable {
# TODO: drop in all-zedhookd ZEDLET.
users.groups.zedhookd = { };
users.users.zedhookd = {
description = "zedhookd daemon user";
group = "zedhookd";
isSystemUser = true;
};
systemd.services.zedhook = {
description = "zedhook ZFS event monitoring system";
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
PermissionsStartOnly = true;
LimitNPROC = 512;
LimitNOFILE = 1048576;
NoNewPrivileges = true;
ExecStart =
"${getBin cfg.package}/bin/zedhookd -d /var/lib/zedhookd/zedhookd.db";
User = "zedhookd";
Restart = "always";
RuntimeDirectory = "zedhookd";
RuntimeDirectoryMode = "0700";
WorkingDirectory = "/var/lib/zedhookd";
StateDirectory = "zedhookd";
StateDirectoryMode = "0700";
};
};
};
}