Merge pull request #137176 from GoldsteinE/clickhouse-package

nixos/clickhouse: add package option
This commit is contained in:
Niklas Hambüchen 2021-11-21 21:43:58 +01:00 committed by GitHub
commit 0939143e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

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";

View file

@ -3,6 +3,7 @@
, icu, jemalloc, libcpuid, libxml2, lld, llvm, lz4, libmysqlclient, openssl, perl
, poco, protobuf, python3, rapidjson, re2, rdkafka, readline, sparsehash, unixODBC
, xxHash, zstd
, nixosTests
}:
stdenv.mkDerivation rec {
@ -64,6 +65,8 @@ stdenv.mkDerivation rec {
# Builds in 7+h with 2 cores, and ~20m with a big-parallel builder.
requiredSystemFeatures = [ "big-parallel" ];
passthru.tests.clickhouse = nixosTests.clickhouse;
meta = with lib; {
homepage = "https://clickhouse.tech/";
description = "Column-oriented database management system";