Skip to content

Commit

Permalink
clickhouse: use lib.recursiveUpdate to deep merge extraConfig (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
conscious-puppet authored Feb 22, 2024
1 parent 625f207 commit ef2f930
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions nix/clickhouse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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`.";
Expand Down Expand Up @@ -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
{
Expand Down

0 comments on commit ef2f930

Please sign in to comment.