From 59ebd721189d8181f0d749eee13804c030dcc345 Mon Sep 17 00:00:00 2001 From: Defelo Date: Wed, 11 Dec 2024 15:46:25 +0100 Subject: [PATCH] nixos/neo4j: add advertisedAddress options --- nixos/modules/services/databases/neo4j.nix | 44 ++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/nixos/modules/services/databases/neo4j.nix b/nixos/modules/services/databases/neo4j.nix index 5b0106eb51d0..cf091ab64b90 100644 --- a/nixos/modules/services/databases/neo4j.nix +++ b/nixos/modules/services/databases/neo4j.nix @@ -61,17 +61,17 @@ let # HTTP Connector server.http.enabled=${lib.boolToString cfg.http.enable} server.http.listen_address=${cfg.http.listenAddress} - server.http.advertised_address=${cfg.http.listenAddress} + server.http.advertised_address=${cfg.http.advertisedAddress} # HTTPS Connector server.https.enabled=${lib.boolToString cfg.https.enable} server.https.listen_address=${cfg.https.listenAddress} - server.https.advertised_address=${cfg.https.listenAddress} + server.https.advertised_address=${cfg.https.advertisedAddress} # BOLT Connector server.bolt.enabled=${lib.boolToString cfg.bolt.enable} server.bolt.listen_address=${cfg.bolt.listenAddress} - server.bolt.advertised_address=${cfg.bolt.listenAddress} + server.bolt.advertised_address=${cfg.bolt.advertisedAddress} server.bolt.tls_level=${cfg.bolt.tlsLevel} # SSL Policies @@ -99,10 +99,8 @@ let # Extra Configuration ${cfg.extraServerConfig} ''; - in { - imports = [ (lib.mkRenamedOptionModule [ "services" "neo4j" "host" ] @@ -160,7 +158,6 @@ in ###### interface options.services.neo4j = { - enable = lib.mkOption { type = lib.types.bool; default = false; @@ -248,6 +245,16 @@ in ''; }; + advertisedAddress = lib.mkOption { + type = lib.types.str; + default = cfg.bolt.listenAddress; + defaultText = lib.literalExpression "config.${opt.bolt.listenAddress}"; + description = '' + Neo4j advertised address for BOLT traffic. The advertised address is + expressed in the format `:`. + ''; + }; + sslPolicy = lib.mkOption { type = lib.types.str; default = "legacy"; @@ -379,6 +386,16 @@ in expressed in the format `:`. ''; }; + + advertisedAddress = lib.mkOption { + type = lib.types.str; + default = cfg.http.listenAddress; + defaultText = lib.literalExpression "config.${opt.http.listenAddress}"; + description = '' + Neo4j advertised address for HTTP traffic. The advertised address is + expressed in the format `:`. + ''; + }; }; https = { @@ -401,6 +418,16 @@ in ''; }; + advertisedAddress = lib.mkOption { + type = lib.types.str; + default = cfg.https.listenAddress; + defaultText = lib.literalExpression "config.${opt.https.listenAddress}"; + description = '' + Neo4j advertised address for HTTPS traffic. The advertised address is + expressed in the format `:`. + ''; + }; + sslPolicy = lib.mkOption { type = lib.types.str; default = "legacy"; @@ -440,7 +467,6 @@ in }: { options = { - allowKeyGeneration = lib.mkOption { type = lib.types.bool; default = false; @@ -590,13 +616,11 @@ in default value. ''; }; - }; config.directoriesToCreate = lib.optionals ( certDirOpt.highestPrio >= 1500 && options.baseDirectory.highestPrio >= 1500 ) (map (opt: opt.value) (lib.filter isDefaultPathOption (lib.attrValues options))); - } ) ); @@ -610,7 +634,6 @@ in for further details. ''; }; - }; ###### implementation @@ -630,7 +653,6 @@ in lib.attrValues cfg.ssl.policies ); in - lib.mkIf cfg.enable { assertions = [ {