···
cfg = config.services.meilisearch;
+
meta.maintainers = with lib.maintainers; [
···
options.services.meilisearch = {
+
enable = lib.mkEnableOption "MeiliSearch - a RESTful search API";
+
package = lib.mkPackageOption pkgs "meilisearch" {
Use this if you require specific features to be enabled. The default package has no features.
+
listenAddress = lib.mkOption {
description = "MeiliSearch listen address.";
+
listenPort = lib.mkOption {
description = "MeiliSearch port to listen on.";
+
environment = lib.mkOption {
description = "Defines the running environment of MeiliSearch.";
+
type = lib.types.enum [
# TODO change this to LoadCredentials once possible
+
masterKeyEnvironmentFile = lib.mkOption {
Path to file which contains the master key.
By doing so, all routes will be protected and will require a key to be accessed.
···
MEILI_MASTER_KEY=my_secret_key
+
type = with lib.types; nullOr path;
+
noAnalytics = lib.mkOption {
Analytics allow MeiliSearch to know how many users are using MeiliSearch,
···
This process is entirely anonymous.
+
logLevel = lib.mkOption {
Defines how much detail should be present in MeiliSearch's logs.
MeiliSearch currently supports four log levels, listed in order of increasing verbosity:
···
Useful when diagnosing issues and debugging
+
maxIndexSize = lib.mkOption {
Sets the maximum size of the index.
Value must be given in bytes or explicitly stating a base unit.
···
default = "107374182400";
+
payloadSizeLimit = lib.mkOption {
Sets the maximum size of accepted JSON payloads.
Value must be given in bytes or explicitly stating a base unit.
···
+
config = lib.mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
···
MEILI_DB_PATH = "/var/lib/meilisearch";
MEILI_HTTP_ADDR = "${cfg.listenAddress}:${toString cfg.listenPort}";
+
MEILI_NO_ANALYTICS = lib.boolToString cfg.noAnalytics;
MEILI_ENV = cfg.environment;
MEILI_DUMP_DIR = "/var/lib/meilisearch/dumps";
MEILI_LOG_LEVEL = cfg.logLevel;
···
ExecStart = "${cfg.package}/bin/meilisearch";
StateDirectory = "meilisearch";
+
EnvironmentFile = lib.mkIf (cfg.masterKeyEnvironmentFile != null) cfg.masterKeyEnvironmentFile;