diff --git a/nix/clickhouse/default.nix b/nix/clickhouse/default.nix index fc8385e5..7f618de7 100644 --- a/nix/clickhouse/default.nix +++ b/nix/clickhouse/default.nix @@ -27,6 +27,28 @@ in description = "The clickhouse data directory"; }; + defaultExtraConfig = lib.mkOption { + type = yamlFormat.type; + internal = true; + readOnly = true; + default = { + logger.level = "warning"; + logger.console = 1; + default_profile = "default"; + default_database = "default"; + tcp_port = toString config.port; + path = "${config.dataDir}/clickhouse"; + tmp_path = "${config.dataDir}/clickhouse/tmp"; + user_files_path = "${config.dataDir}/clickhouse/user_files"; + format_schema_path = "${config.dataDir}/clickhouse/format_schemas"; + user_directories = { + users_xml = { + path = "${config.package}/etc/clickhouse-server/users.xml"; + }; + }; + }; + }; + extraConfig = lib.mkOption { type = yamlFormat.type; description = "Additional configuration to be appended to `clickhouse-config.yaml`."; @@ -75,24 +97,7 @@ in processes = let clickhouseConfig = yamlFormat.generate "clickhouse-config.yaml" ( - { - logger = { - level = "warning"; - console = 1; - }; - tcp_port = "${toString config.port}"; - default_profile = "default"; - default_database = "default"; - path = "${config.dataDir}/clickhouse"; - tmp_path = "${config.dataDir}/clickhouse/tmp"; - user_files_path = "${config.dataDir}/clickhouse/user_files"; - format_schema_path = "${config.dataDir}/clickhouse/format_schemas"; - user_directories = { - users_xml = { - path = "${config.package}/etc/clickhouse-server/users.xml"; - }; - }; - } // config.extraConfig + lib.recursiveUpdate config.defaultExtraConfig config.extraConfig ); in {