1 { config, lib, pkgs, ... }:
3 cfg = config.services.ulogd;
4 settingsFormat = pkgs.formats.ini { listsAsDuplicateKeys = true; };
5 settingsFile = settingsFormat.generate "ulogd.conf" cfg.settings;
9 enable = lib.mkEnableOption "ulogd, a userspace logging daemon for netfilter/iptables related logging";
11 settings = lib.mkOption {
14 "log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu1:LOGEMU"
15 "log1:NFLOG,base1:BASE,pcap1:PCAP"
22 file = "/var/log/ulogd.pcap";
27 file = "/var/log/ulogd_pkts.log";
30 type = settingsFormat.type;
33 "Configuration for ulogd. See {file}`/share/doc/ulogd/` in `pkgs.ulogd.doc`.";
36 logLevel = lib.mkOption {
37 type = lib.types.enum [ 1 3 5 7 8 ];
40 "Log level (1 = debug, 3 = info, 5 = notice, 7 = error, 8 = fatal)";
45 config = lib.mkIf cfg.enable {
46 systemd.services.ulogd = {
47 description = "Ulogd Daemon";
48 wantedBy = [ "multi-user.target" ];
49 wants = [ "network-pre.target" ];
50 before = [ "network-pre.target" ];
54 "${pkgs.ulogd}/bin/ulogd -c ${settingsFile} --verbose --loglevel ${
57 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";