From 427941d7377ff2762305f36479fb4365ad2abe68 Mon Sep 17 00:00:00 2001 From: Goldstein Date: Thu, 9 Sep 2021 14:44:25 +0300 Subject: [PATCH 1/2] nixos/clickhouse: add package option Consistent with other services and helps to work around #130101 --- nixos/modules/services/databases/clickhouse.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/databases/clickhouse.nix b/nixos/modules/services/databases/clickhouse.nix index f2f4e9d25542..3a161d56107e 100644 --- a/nixos/modules/services/databases/clickhouse.nix +++ b/nixos/modules/services/databases/clickhouse.nix @@ -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"; From faadbddcd7af99f908c9111c6612e90dae1c201e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Sun, 21 Nov 2021 20:38:57 +0100 Subject: [PATCH 2/2] clickhouse: Add passthru.tests --- pkgs/servers/clickhouse/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/servers/clickhouse/default.nix b/pkgs/servers/clickhouse/default.nix index 8c71b37d526b..6372730afafe 100644 --- a/pkgs/servers/clickhouse/default.nix +++ b/pkgs/servers/clickhouse/default.nix @@ -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";