1 { config, lib, pkgs, ... }:
4 cfg = config.services.sonic-server;
6 settingsFormat = pkgs.formats.toml { };
7 configFile = settingsFormat.generate "sonic-server-config.toml" cfg.settings;
10 meta.maintainers = [ lib.maintainers.anthonyroussel ];
13 services.sonic-server = {
14 enable = lib.mkEnableOption "Sonic Search Index";
16 package = lib.mkPackageOption pkgs "sonic-server" { };
18 settings = lib.mkOption {
19 type = lib.types.submodule { freeformType = settingsFormat.type; };
21 store.kv.path = "/var/lib/sonic/kv";
22 store.fst.path = "/var/lib/sonic/fst";
25 server.log_level = "debug";
26 channel.inet = "[::1]:1491";
29 Sonic Server configuration options.
32 <https://github.com/valeriansaliou/sonic/blob/master/CONFIGURATION.md>
33 for a full list of available options.
39 config = lib.mkIf cfg.enable {
40 services.sonic-server.settings = lib.mapAttrs (name: lib.mkDefault) {
45 path = "/var/lib/sonic/kv";
50 path = "/var/lib/sonic/fst";
57 systemd.services.sonic-server = {
58 description = "Sonic Search Index";
60 wantedBy = [ "multi-user.target" ];
61 after = [ "network.target" ];
66 ExecStart = "${lib.getExe cfg.package} -c ${configFile}";
69 LimitNOFILE = "infinity";
70 Restart = "on-failure";
71 StateDirectory = "sonic";
72 StateDirectoryMode = "750";