nixos/services.opensearch: remove with lib;
This commit is contained in:
@@ -4,9 +4,6 @@
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.opensearch;
|
||||
|
||||
@@ -28,7 +25,7 @@ in
|
||||
{
|
||||
|
||||
options.services.opensearch = {
|
||||
enable = mkEnableOption "OpenSearch";
|
||||
enable = lib.mkEnableOption "OpenSearch";
|
||||
|
||||
package = lib.mkPackageOption pkgs "OpenSearch" {
|
||||
default = [ "opensearch" ];
|
||||
@@ -113,13 +110,13 @@ in
|
||||
rootLogger.level = info
|
||||
rootLogger.appenderRef.console.ref = console
|
||||
'';
|
||||
type = types.str;
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
dataDir = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/lib/opensearch";
|
||||
apply = converge (removeSuffix "/");
|
||||
apply = lib.converge (lib.removeSuffix "/");
|
||||
description = ''
|
||||
Data directory for OpenSearch. If you change this, you need to
|
||||
manually create the directory. You also need to create the
|
||||
@@ -173,7 +170,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.opensearch = {
|
||||
description = "OpenSearch Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@@ -194,7 +191,7 @@ in
|
||||
set -o errexit -o pipefail -o nounset -o errtrace
|
||||
shopt -s inherit_errexit
|
||||
''
|
||||
+ (optionalString (!config.boot.isContainer) ''
|
||||
+ (lib.optionalString (!config.boot.isContainer) ''
|
||||
# Only set vm.max_map_count if lower than ES required minimum
|
||||
# This avoids conflict if configured via boot.kernel.sysctl
|
||||
if [ $(${pkgs.procps}/bin/sysctl -n vm.max_map_count) -lt 262144 ]; then
|
||||
@@ -268,7 +265,7 @@ in
|
||||
TimeoutStartSec = "infinity";
|
||||
DynamicUser = usingDefaultUserAndGroup && usingDefaultDataDir;
|
||||
}
|
||||
// (optionalAttrs (usingDefaultDataDir) {
|
||||
// (lib.optionalAttrs (usingDefaultDataDir) {
|
||||
StateDirectory = "opensearch";
|
||||
StateDirectoryMode = "0700";
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user