12 cfg = config.services.manticore;
13 format = pkgs.formats.json { };
17 mkKeyValue ? generators.mkKeyValueDefault { } "=",
18 listsAsDuplicateKeys ? true,
22 # map function to string for each key val
23 mapAttrsToStringsSep =
25 concatStringsSep sep (mapAttrsToList mapFn attrs);
31 + lib.generators.toKeyValue { inherit mkKeyValue listsAsDuplicateKeys; } sectValues
34 # map input to ini sections
35 mapAttrsToStringsSep "\n" mkSection attrsOfAttrs;
37 configFile = pkgs.writeText "manticore.conf" (
39 mkKeyValue = k: v: " ${k} = ${v}";
47 services.manticore = {
49 enable = mkEnableOption "Manticoresearch";
56 "127.0.0.1:9306:mysql"
59 log = "/var/log/manticore/searchd.log";
60 query_log = "/var/log/manticore/query.log";
61 pid_file = "/run/manticore/searchd.pid";
62 data_dir = "/var/lib/manticore";
66 Configuration for Manticoresearch. See
67 <https://manual.manticoresearch.com/Server%20settings>
70 type = types.submodule {
71 freeformType = format.type;
73 example = literalExpression ''
78 "127.0.0.1:9306:mysql"
81 log = "/var/log/manticore/searchd.log";
82 query_log = "/var/log/manticore/query.log";
83 pid_file = "/run/manticore/searchd.pid";
84 data_dir = "/var/lib/manticore";
93 config = mkIf cfg.enable {
96 packages = [ pkgs.manticoresearch ];
97 services.manticore = {
98 wantedBy = [ "multi-user.target" ];
99 after = [ "network.target" ];
104 "${pkgs.manticoresearch}/bin/searchd --config ${configFile}"
108 "${pkgs.manticoresearch}/bin/searchd --config ${configFile} --stopwait"
110 ExecStartPre = [ "" ];
112 LogsDirectory = "manticore";
113 RuntimeDirectory = "manticore";
114 StateDirectory = "manticore";
116 CapabilityBoundingSet = "";
117 RestrictAddressFamilies = [
122 RestrictNamespaces = true;
123 PrivateDevices = true;
126 ProtectControlGroups = true;
128 ProtectKernelLogs = true;
129 ProtectKernelModules = true;
130 ProtectKernelTunables = true;
131 SystemCallArchitectures = "native";
136 RestrictRealtime = true;
137 LockPersonality = true;
138 MemoryDenyWriteExecute = true;
140 ProtectHostname = true;
142 // lib.optionalAttrs (cfg.settings.searchd.pid_file != null) {
143 PIDFile = cfg.settings.searchd.pid_file;
150 meta.maintainers = with lib.maintainers; [ onny ];