Skip to content

Commit

Permalink
clickhouse: add new options and internal options
Browse files Browse the repository at this point in the history
  • Loading branch information
conscious-puppet committed Feb 22, 2024
1 parent b826572 commit 487bf05
Showing 1 changed file with 87 additions and 16 deletions.
103 changes: 87 additions & 16 deletions nix/clickhouse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,82 @@ in
description = "The clickhouse data directory";
};

loggerLevel = lib.mkOption {
type = types.str;
default = "warning";
description = "Log level for clickhouse";
};

loggerConsole = lib.mkOption {
type = types.int;
default = 1;
description = "Log to console if not daemon mode and is tty";
};

defaultProfile = lib.mkOption {
type = types.str;
default = "default";
description = "Default profile of settings";
};

defaultDatabase = lib.mkOption {
type = types.str;
default = "default";
description = "Default database";
};

tcp_port = lib.mkOption {
type = types.str;
internal = true;
readOnly = true;
default = toString config.port;
description = "Log to console if not daemon mode and is tty";
};

path = lib.mkOption {
type = types.str;
internal = true;
readOnly = true;
default = "${config.dataDir}/clickhouse";
description = "Path to data directory";
};

tmp_path = lib.mkOption {
type = types.str;
internal = true;
readOnly = true;
default = "${config.dataDir}/clickhouse/tmp";
description = "Path to temporary data for processing hard queries";
};

user_files_path = lib.mkOption {
type = types.str;
internal = true;
readOnly = true;
default = "${config.dataDir}/clickhouse/user_files";
description = "Directory with user provided files that are accessible by 'file' table function";
};

format_schema_path = lib.mkOption {
type = types.str;
internal = true;
readOnly = true;
default = "${config.dataDir}/clickhouse/format_schemas";
description = "Directory containing schema files for various input formats";
};

user_directories = lib.mkOption {
type = yamlFormat.type;
internal = true;
readOnly = true;
default = {
users_xml = {
path = "${config.package}/etc/clickhouse-server/users.xml";
};
};
description = "Sources to read users, roles, access rights, profiles of settings, quotas";
};

extraConfig = lib.mkOption {
type = yamlFormat.type;
description = "Additional configuration to be appended to `clickhouse-config.yaml`.";
Expand Down Expand Up @@ -78,22 +154,17 @@ in
lib.recursiveUpdate
config.extraConfig
{
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";
};
};
logger.level = config.loggerLevel;
logger.console = config.loggerConsole;
default_profile = config.defaultProfile;
default_database = config.defaultDatabase;
inherit (config)
tcp_port
path
tmp_path
user_files_path
format_schema_path
user_directories;
}
);
in
Expand Down

0 comments on commit 487bf05

Please sign in to comment.