nixos/clickhouse: add package option

Consistent with other services and helps to work around #130101
This commit is contained in:
Goldstein 2021-09-09 14:44:25 +03:00 committed by Niklas Hambüchen
parent 4e89f2a609
commit 427941d737

View file

@ -13,6 +13,15 @@ with lib;
enable = mkEnableOption "ClickHouse database server";
package = mkOption {
type = types.package;
default = pkgs.clickhouse;
defaultText = "pkgs.clickhouse";
description = ''
ClickHouse package to use.
'';
};
};
};
@ -45,21 +54,21 @@ with lib;
AmbientCapabilities = "CAP_SYS_NICE";
StateDirectory = "clickhouse";
LogsDirectory = "clickhouse";
ExecStart = "${pkgs.clickhouse}/bin/clickhouse-server --config-file=${pkgs.clickhouse}/etc/clickhouse-server/config.xml";
ExecStart = "${cfg.package}/bin/clickhouse-server --config-file=${cfg.package}/etc/clickhouse-server/config.xml";
};
};
environment.etc = {
"clickhouse-server/config.xml" = {
source = "${pkgs.clickhouse}/etc/clickhouse-server/config.xml";
source = "${cfg.package}/etc/clickhouse-server/config.xml";
};
"clickhouse-server/users.xml" = {
source = "${pkgs.clickhouse}/etc/clickhouse-server/users.xml";
source = "${cfg.package}/etc/clickhouse-server/users.xml";
};
};
environment.systemPackages = [ pkgs.clickhouse ];
environment.systemPackages = [ cfg.package ];
# startup requires a `/etc/localtime` which only if exists if `time.timeZone != null`
time.timeZone = mkDefault "UTC";