nixos/services.meilisearch: remove `with lib;`

Changed files
+22 -25
nixos
modules
services
+22 -25
nixos/modules/services/search/meilisearch.nix
···
pkgs,
...
}:
-
-
with lib;
-
let
cfg = config.services.meilisearch;
in
{
-
meta.maintainers = with maintainers; [
Br1ght0ne
happysalada
];
···
###### interface
options.services.meilisearch = {
-
enable = mkEnableOption "MeiliSearch - a RESTful search API";
-
package = mkPackageOption pkgs "meilisearch" {
extraDescription = ''
Use this if you require specific features to be enabled. The default package has no features.
'';
};
-
listenAddress = mkOption {
description = "MeiliSearch listen address.";
default = "127.0.0.1";
-
type = types.str;
};
-
listenPort = mkOption {
description = "MeiliSearch port to listen on.";
default = 7700;
-
type = types.port;
};
-
environment = mkOption {
description = "Defines the running environment of MeiliSearch.";
default = "development";
-
type = types.enum [
"development"
"production"
];
};
# TODO change this to LoadCredentials once possible
-
masterKeyEnvironmentFile = mkOption {
description = ''
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
'';
default = null;
-
type = with types; nullOr path;
};
-
noAnalytics = mkOption {
description = ''
Deactivates analytics.
Analytics allow MeiliSearch to know how many users are using MeiliSearch,
···
This process is entirely anonymous.
'';
default = true;
-
type = types.bool;
};
-
logLevel = mkOption {
description = ''
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
'';
default = "INFO";
-
type = types.str;
};
-
maxIndexSize = mkOption {
description = ''
Sets the maximum size of the index.
Value must be given in bytes or explicitly stating a base unit.
···
Default is 100 GiB
'';
default = "107374182400";
-
type = types.str;
};
-
payloadSizeLimit = mkOption {
description = ''
Sets the maximum size of accepted JSON payloads.
Value must be given in bytes or explicitly stating a base unit.
···
Default is ~ 100 MB
'';
default = "104857600";
-
type = types.str;
};
};
###### implementation
-
config = mkIf cfg.enable {
# used to restore dumps
environment.systemPackages = [ cfg.package ];
···
environment = {
MEILI_DB_PATH = "/var/lib/meilisearch";
MEILI_HTTP_ADDR = "${cfg.listenAddress}:${toString cfg.listenPort}";
-
MEILI_NO_ANALYTICS = boolToString cfg.noAnalytics;
MEILI_ENV = cfg.environment;
MEILI_DUMP_DIR = "/var/lib/meilisearch/dumps";
MEILI_LOG_LEVEL = cfg.logLevel;
···
ExecStart = "${cfg.package}/bin/meilisearch";
DynamicUser = true;
StateDirectory = "meilisearch";
-
EnvironmentFile = mkIf (cfg.masterKeyEnvironmentFile != null) cfg.masterKeyEnvironmentFile;
};
};
};
···
pkgs,
...
}:
let
cfg = config.services.meilisearch;
in
{
+
meta.maintainers = with lib.maintainers; [
Br1ght0ne
happysalada
];
···
###### interface
options.services.meilisearch = {
+
enable = lib.mkEnableOption "MeiliSearch - a RESTful search API";
+
package = lib.mkPackageOption pkgs "meilisearch" {
extraDescription = ''
Use this if you require specific features to be enabled. The default package has no features.
'';
};
+
listenAddress = lib.mkOption {
description = "MeiliSearch listen address.";
default = "127.0.0.1";
+
type = lib.types.str;
};
+
listenPort = lib.mkOption {
description = "MeiliSearch port to listen on.";
default = 7700;
+
type = lib.types.port;
};
+
environment = lib.mkOption {
description = "Defines the running environment of MeiliSearch.";
default = "development";
+
type = lib.types.enum [
"development"
"production"
];
};
# TODO change this to LoadCredentials once possible
+
masterKeyEnvironmentFile = lib.mkOption {
description = ''
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
'';
default = null;
+
type = with lib.types; nullOr path;
};
+
noAnalytics = lib.mkOption {
description = ''
Deactivates analytics.
Analytics allow MeiliSearch to know how many users are using MeiliSearch,
···
This process is entirely anonymous.
'';
default = true;
+
type = lib.types.bool;
};
+
logLevel = lib.mkOption {
description = ''
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
'';
default = "INFO";
+
type = lib.types.str;
};
+
maxIndexSize = lib.mkOption {
description = ''
Sets the maximum size of the index.
Value must be given in bytes or explicitly stating a base unit.
···
Default is 100 GiB
'';
default = "107374182400";
+
type = lib.types.str;
};
+
payloadSizeLimit = lib.mkOption {
description = ''
Sets the maximum size of accepted JSON payloads.
Value must be given in bytes or explicitly stating a base unit.
···
Default is ~ 100 MB
'';
default = "104857600";
+
type = lib.types.str;
};
};
###### implementation
+
config = lib.mkIf cfg.enable {
# used to restore dumps
environment.systemPackages = [ cfg.package ];
···
environment = {
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";
DynamicUser = true;
StateDirectory = "meilisearch";
+
EnvironmentFile = lib.mkIf (cfg.masterKeyEnvironmentFile != null) cfg.masterKeyEnvironmentFile;
};
};
};