···
# This module defines global configuration for Haka.
cfg = config.services.haka;
···
"${haka}/share/haka/sample/${cfg.configFile}"
+
${lib.optionalString (builtins.lessThan 0 cfg.threads) "thread = ${cfg.threads}"}
+
${lib.optionalString cfg.pcap ''module = "packet/pcap"''}
+
${lib.optionalString cfg.nfqueue ''module = "packet/nqueue"''}
+
${lib.optionalString cfg.dump.enable ''dump = "yes"''}
+
${lib.optionalString cfg.dump.enable ''dump_input = "${cfg.dump.input}"''}
+
${lib.optionalString cfg.dump.enable ''dump_output = "${cfg.dump.output}"''}
interfaces = "${lib.strings.concatStringsSep "," cfg.interfaces}"
···
+
enable = lib.mkEnableOption "Haka";
+
package = lib.mkPackageOption pkgs "haka" { };
+
configFile = lib.mkOption {
example = "/srv/haka/myfilter.lua";
Specify which configuration file Haka uses.
It can be absolute path or a path relative to the sample directory of
···
+
interfaces = lib.mkOption {
+
type = with lib.types; listOf str;
Specify which interface(s) Haka listens to.
Use 'any' to listen to all interfaces.
+
threads = lib.mkOption {
The number of threads that will be used.
All system threads are used by default.
description = "Whether to enable pcap";
+
nfqueue = lib.mkEnableOption "nfqueue";
+
dump.enable = lib.mkEnableOption "dump";
+
dump.input = lib.mkOption {
default = "/tmp/input.pcap";
example = "/path/to/file.pcap";
description = "Path to file where incoming packets are dumped";
+
dump.output = lib.mkOption {
default = "/tmp/output.pcap";
example = "/path/to/file.pcap";
description = "Path to file where outgoing packets are dumped";
···
+
config = lib.mkIf cfg.enable {