diff --git a/nixos/modules/services/search/elasticsearch.nix b/nixos/modules/services/search/elasticsearch.nix index 3f676db27523..40ebe29c9a60 100644 --- a/nixos/modules/services/search/elasticsearch.nix +++ b/nixos/modules/services/search/elasticsearch.nix @@ -5,13 +5,13 @@ with lib; let cfg = config.services.elasticsearch; + es7 = builtins.compareVersions cfg.package.version "7" >= 0; + esConfig = '' network.host: ${cfg.listenAddress} cluster.name: ${cfg.cluster_name} - ${lib.optionalString cfg.single_node '' - discovery.type: single-node - gateway.auto_import_dangling_indices: true - ''} + ${lib.optionalString cfg.single_node "discovery.type: single-node"} + ${lib.optionalString (cfg.single_node && es7) "gateway.auto_import_dangling_indices: true"} http.port: ${toString cfg.port} transport.port: ${toString cfg.tcp_port}