mirror of
https://github.com/mdlayher/homelab.git
synced 2024-12-14 11:47:32 +00:00
391cfc0de0
Signed-off-by: Matt Layher <mdlayher@gmail.com>
49 lines
1.3 KiB
Nix
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";
|
|
};
|
|
};
|
|
};
|
|
}
|