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

Changed files
+6 -9
nixos
modules
services
+6 -9
nixos/modules/services/search/opensearch.nix
···
pkgs,
...
}:
-
-
with lib;
-
let
cfg = config.services.opensearch;
···
{
options.services.opensearch = {
-
enable = mkEnableOption "OpenSearch";
+
enable = lib.mkEnableOption "OpenSearch";
package = lib.mkPackageOption pkgs "OpenSearch" {
default = [ "opensearch" ];
···
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
···
};
};
-
config = mkIf cfg.enable {
+
config = lib.mkIf cfg.enable {
systemd.services.opensearch = {
description = "OpenSearch Daemon";
wantedBy = [ "multi-user.target" ];
···
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
···
TimeoutStartSec = "infinity";
DynamicUser = usingDefaultUserAndGroup && usingDefaultDataDir;
}
-
// (optionalAttrs (usingDefaultDataDir) {
+
// (lib.optionalAttrs (usingDefaultDataDir) {
StateDirectory = "opensearch";
StateDirectoryMode = "0700";
});