clickhouse: 25.3.5.42 → 25.7.4.11 (#423835)

This commit is contained in:
misuzu
2025-08-14 23:00:04 +03:00
committed by GitHub
11 changed files with 283 additions and 186 deletions
+4
View File
@@ -113,6 +113,10 @@
- `fetchgit`: Add `rootDir` argument to limit the resulting source to one subdirectory of the whole Git repository. Corresponding `--root-dir` option added to `nix-prefetch-git`.
- The `clickhouse` package now track the stable upstream version per [upstream's
recommendation](https://clickhouse.com/docs/faq/operations/production). Users
can continue to use the `clickhouse-lts` package if desired.
## Nixpkgs Library {#sec-nixpkgs-release-25.11-lib}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+8 -1
View File
@@ -333,7 +333,14 @@ in
cinnamon-wayland = runTest ./cinnamon-wayland.nix;
cjdns = runTest ./cjdns.nix;
clatd = runTest ./clatd.nix;
clickhouse = import ./clickhouse { inherit runTest; };
clickhouse = import ./clickhouse {
inherit runTest;
package = pkgs.clickhouse;
};
clickhouse-lts = import ./clickhouse {
inherit runTest;
package = pkgs.clickhouse-lts;
};
cloud-init = runTest ./cloud-init.nix;
cloud-init-hostname = runTest ./cloud-init-hostname.nix;
cloudlog = runTest ./cloudlog.nix;
+9 -3
View File
@@ -1,10 +1,16 @@
{ pkgs, ... }:
{ pkgs, package, ... }:
{
name = "clickhouse";
meta.maintainers = with pkgs.lib.maintainers; [ jpds ];
meta.maintainers = with pkgs.lib.maintainers; [
jpds
thevar1able
];
nodes.machine = {
services.clickhouse.enable = true;
services.clickhouse = {
enable = true;
inherit package;
};
virtualisation.memorySize = 4096;
};
+28 -5
View File
@@ -1,8 +1,31 @@
{ runTest }:
{
runTest,
package,
}:
{
base = runTest ./base.nix;
kafka = runTest ./kafka.nix;
keeper = runTest ./keeper.nix;
s3 = runTest ./s3.nix;
base = runTest {
imports = [ ./base.nix ];
_module.args = {
inherit package;
};
};
kafka = runTest {
imports = [ ./kafka.nix ];
_module.args = {
inherit package;
};
};
keeper = runTest {
imports = [ ./keeper.nix ];
_module.args = {
inherit package;
};
};
s3 = runTest {
imports = [ ./s3.nix ];
_module.args = {
inherit package;
};
};
}
+9 -3
View File
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, package, ... }:
let
kafkaNamedCollectionConfig = ''
@@ -28,7 +28,10 @@ let
in
{
name = "clickhouse-kafka";
meta.maintainers = with pkgs.lib.maintainers; [ jpds ];
meta.maintainers = with pkgs.lib.maintainers; [
jpds
thevar1able
];
nodes = {
clickhouse = {
@@ -38,7 +41,10 @@ in
};
};
services.clickhouse.enable = true;
services.clickhouse = {
enable = true;
inherit package;
};
virtualisation.memorySize = 4096;
};
+14 -3
View File
@@ -1,7 +1,15 @@
{ lib, pkgs, ... }:
{
lib,
pkgs,
package,
...
}:
rec {
name = "clickhouse-keeper";
meta.maintainers = with pkgs.lib.maintainers; [ jpds ];
meta.maintainers = with pkgs.lib.maintainers; [
jpds
thevar1able
];
nodes =
let
@@ -94,7 +102,10 @@ rec {
9444
];
services.clickhouse.enable = true;
services.clickhouse = {
enable = true;
inherit package;
};
systemd.services.clickhouse = {
after = [ "network-online.target" ];
+9 -3
View File
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, package, ... }:
let
s3 = {
@@ -40,7 +40,10 @@ let
in
{
name = "clickhouse-s3";
meta.maintainers = with pkgs.lib.maintainers; [ jpds ];
meta.maintainers = with pkgs.lib.maintainers; [
jpds
thevar1able
];
nodes = {
clickhouse = {
@@ -50,7 +53,10 @@ in
};
};
services.clickhouse.enable = true;
services.clickhouse = {
enable = true;
inherit package;
};
virtualisation.diskSize = 15 * 1024;
virtualisation.memorySize = 4 * 1024;
};
+179
View File
@@ -0,0 +1,179 @@
{
lts ? false,
version,
hash,
nixUpdateExtraArgs ? [ ],
}:
{
lib,
stdenv,
llvmPackages_19,
fetchFromGitHub,
cmake,
ninja,
python3,
perl,
nasm,
yasm,
nixosTests,
darwin,
findutils,
libiconv,
rustSupport ? true,
rustc,
cargo,
rustPlatform,
nix-update-script,
}:
llvmPackages_19.stdenv.mkDerivation (finalAttrs: {
pname = "clickhouse" + lib.optionalString lts "-lts";
inherit version;
src = fetchFromGitHub rec {
owner = "ClickHouse";
repo = "ClickHouse";
tag = "v${finalAttrs.version}";
fetchSubmodules = true;
name = "clickhouse-${tag}.tar.gz";
inherit hash;
postFetch = ''
# delete files that make the source too big
rm -rf $out/contrib/llvm-project/llvm/test
rm -rf $out/contrib/llvm-project/clang/test
rm -rf $out/contrib/croaring/benchmarks
# fix case insensitivity on macos https://github.com/NixOS/nixpkgs/issues/39308
rm -rf $out/contrib/sysroot/linux-*
rm -rf $out/contrib/liburing/man
# compress to not exceed the 2GB output limit
# try to make a deterministic tarball
tar -I 'gzip -n' \
--sort=name \
--mtime=1970-01-01 \
--owner=0 --group=0 \
--numeric-owner --mode=go=rX,u+rw,a-s \
--transform='s@^@source/@S' \
-cf temp -C "$out" .
rm -r "$out"
mv temp "$out"
'';
};
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
python3
perl
llvmPackages_19.lld
]
++ lib.optionals stdenv.hostPlatform.isx86_64 [
nasm
yasm
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages_19.bintools
findutils
darwin.bootstrap_cmds
]
++ lib.optionals rustSupport [
rustc
cargo
rustPlatform.cargoSetupHook
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
dontCargoSetupPostUnpack = true;
postPatch = ''
patchShebangs src/ utils/
sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt
substituteInPlace utils/list-licenses/list-licenses.sh \
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
''
+ lib.optionalString (lib.versions.majorMinor version <= "25.6") ''
substituteInPlace src/Storages/System/StorageSystemLicenses.sh \
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/tools.cmake \
--replace-fail 'gfind' 'find' \
--replace-fail 'ggrep' 'grep' \
--replace-fail '--ld-path=''${LLD_PATH}' '-fuse-ld=lld'
''
# Rust is handled by cmake
+ lib.optionalString rustSupport ''
cargoSetupPostPatchHook() { true; }
'';
cmakeFlags = [
"-DENABLE_CHDIG=OFF"
"-DENABLE_TESTS=OFF"
"-DENABLE_DELTA_KERNEL_RS=0"
"-DCOMPILER_CACHE=disabled"
]
++ lib.optional (
stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64
) "-DNO_ARMV81_OR_HIGHER=1";
env = {
CARGO_HOME = "$PWD/../.cargo/";
NIX_CFLAGS_COMPILE =
# undefined reference to '__sync_val_compare_and_swap_16'
lib.optionalString stdenv.hostPlatform.isx86_64 " -mcx16"
+
# Silence ``-Wimplicit-const-int-float-conversion` error in MemoryTracker.cpp and
# ``-Wno-unneeded-internal-declaration` TreeOptimizer.cpp.
lib.optionalString stdenv.hostPlatform.isDarwin
" -Wno-implicit-const-int-float-conversion -Wno-unneeded-internal-declaration";
};
# https://github.com/ClickHouse/ClickHouse/issues/49988
hardeningDisable = [ "fortify" ];
postInstall = ''
sed -i -e '\!<log>/var/log/clickhouse-server/clickhouse-server\.log</log>!d' \
$out/etc/clickhouse-server/config.xml
substituteInPlace $out/etc/clickhouse-server/config.xml \
--replace-fail "<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>" "<console>1</console>" \
--replace-fail "<level>trace</level>" "<level>warning</level>"
'';
# Basic smoke test
doCheck = true;
checkPhase = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
$NIX_BUILD_TOP/$sourceRoot/build/programs/clickhouse local --query 'SELECT 1' | grep 1
'';
# Builds in 7+h with 2 cores, and ~20m with a big-parallel builder.
requiredSystemFeatures = [ "big-parallel" ];
passthru = {
tests.clickhouse = if lts then nixosTests.clickhouse-lts else nixosTests.clickhouse;
updateScript = nix-update-script {
extraArgs = nixUpdateExtraArgs;
};
};
meta = with lib; {
homepage = "https://clickhouse.com";
description = "Column-oriented database management system";
license = licenses.asl20;
maintainers = with maintainers; [
orivej
mbalatsko
thevar1able
];
# not supposed to work on 32-bit https://github.com/ClickHouse/ClickHouse/pull/23959#issuecomment-835343685
platforms = lib.filter (x: (lib.systems.elaborate x).is64bit) (platforms.linux ++ platforms.darwin);
broken = stdenv.buildPlatform != stdenv.hostPlatform;
};
})
+11
View File
@@ -0,0 +1,11 @@
import ./generic.nix {
version = "25.3.6.56-lts";
hash = "sha256-wpC6uw811IWImLWAatYbghp3aZ+esEEBFng6AHIesK4=";
lts = true;
nixUpdateExtraArgs = [
"--version-regex"
"^v?(.*-lts)$"
"--override-filename"
"pkgs/by-name/cl/clickhouse/lts.nix"
];
}
+10 -168
View File
@@ -1,169 +1,11 @@
{
lib,
stdenv,
llvmPackages_19,
fetchFromGitHub,
cmake,
ninja,
python3,
perl,
nasm,
yasm,
nixosTests,
darwin,
findutils,
libiconv,
rustSupport ? true,
rustc,
cargo,
rustPlatform,
}:
llvmPackages_19.stdenv.mkDerivation (finalAttrs: {
pname = "clickhouse";
version = "25.3.5.42";
src = fetchFromGitHub rec {
owner = "ClickHouse";
repo = "ClickHouse";
tag = "v${finalAttrs.version}-lts";
fetchSubmodules = true;
name = "clickhouse-${tag}.tar.gz";
hash = "sha256-LvGl9XJK6Emt7HnV/Orp7qEmJSr3TBJZtApL6GrWIMg=";
postFetch = ''
# delete files that make the source too big
rm -rf $out/contrib/llvm-project/llvm/test
rm -rf $out/contrib/llvm-project/clang/test
rm -rf $out/contrib/croaring/benchmarks
# fix case insensitivity on macos https://github.com/NixOS/nixpkgs/issues/39308
rm -rf $out/contrib/sysroot/linux-*
rm -rf $out/contrib/liburing/man
# compress to not exceed the 2GB output limit
# try to make a deterministic tarball
tar -I 'gzip -n' \
--sort=name \
--mtime=1970-01-01 \
--owner=0 --group=0 \
--numeric-owner --mode=go=rX,u+rw,a-s \
--transform='s@^@source/@S' \
-cf temp -C "$out" .
rm -r "$out"
mv temp "$out"
'';
};
strictDeps = true;
nativeBuildInputs = [
cmake
ninja
python3
perl
llvmPackages_19.lld
]
++ lib.optionals stdenv.hostPlatform.isx86_64 [
nasm
yasm
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
llvmPackages_19.bintools
findutils
darwin.bootstrap_cmds
]
++ lib.optionals rustSupport [
rustc
cargo
rustPlatform.cargoSetupHook
import ./generic.nix {
version = "25.7.4.11-stable";
hash = "sha256-SKDnnBdl9Rwc+ONH1chXAOFIwRmVG2l5cPEwpaDogzU=";
lts = false;
nixUpdateExtraArgs = [
"--version-regex"
"^v?(.*-stable)$"
"--override-filename"
"pkgs/by-name/cl/clickhouse/package.nix"
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
dontCargoSetupPostUnpack = true;
postPatch = ''
patchShebangs src/
patchShebangs utils/
sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt
substituteInPlace src/Storages/System/StorageSystemLicenses.sh \
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
substituteInPlace utils/check-style/check-ungrouped-includes.sh \
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
substituteInPlace utils/list-licenses/list-licenses.sh \
--replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -i 's|gfind|find|' cmake/tools.cmake
sed -i 's|ggrep|grep|' cmake/tools.cmake
# Make sure Darwin invokes lld.ld64 not lld.
substituteInPlace cmake/tools.cmake \
--replace '--ld-path=''${LLD_PATH}' '-fuse-ld=lld'
''
+ lib.optionalString rustSupport ''
cargoSetupPostPatchHook() { true; }
'';
cmakeFlags = [
"-DENABLE_TESTS=OFF"
"-DENABLE_DELTA_KERNEL_RS=0"
"-DCOMPILER_CACHE=disabled"
]
++ lib.optional (
stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64
) "-DNO_ARMV81_OR_HIGHER=1";
env = {
CARGO_HOME = "$PWD/../.cargo/";
NIX_CFLAGS_COMPILE =
# undefined reference to '__sync_val_compare_and_swap_16'
lib.optionalString stdenv.hostPlatform.isx86_64 " -mcx16"
+
# Silence ``-Wimplicit-const-int-float-conversion` error in MemoryTracker.cpp and
# ``-Wno-unneeded-internal-declaration` TreeOptimizer.cpp.
lib.optionalString stdenv.hostPlatform.isDarwin
" -Wno-implicit-const-int-float-conversion -Wno-unneeded-internal-declaration";
};
# https://github.com/ClickHouse/ClickHouse/issues/49988
hardeningDisable = [ "fortify" ];
postInstall = ''
rm -rf $out/share/clickhouse-test
sed -i -e '\!<log>/var/log/clickhouse-server/clickhouse-server\.log</log>!d' \
$out/etc/clickhouse-server/config.xml
substituteInPlace $out/etc/clickhouse-server/config.xml \
--replace-fail "<errorlog>/var/log/clickhouse-server/clickhouse-server.err.log</errorlog>" "<console>1</console>"
substituteInPlace $out/etc/clickhouse-server/config.xml \
--replace-fail "<level>trace</level>" "<level>warning</level>"
'';
# Basic smoke test
doCheck = true;
checkPhase = ''
$NIX_BUILD_TOP/$sourceRoot/build/programs/clickhouse local --query 'SELECT 1' | grep 1
'';
# 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.com";
description = "Column-oriented database management system";
license = licenses.asl20;
maintainers = with maintainers; [
orivej
mbalatsko
thevar1able
];
# not supposed to work on 32-bit https://github.com/ClickHouse/ClickHouse/pull/23959#issuecomment-835343685
platforms = lib.filter (x: (lib.systems.elaborate x).is64bit) (platforms.linux ++ platforms.darwin);
broken = stdenv.buildPlatform != stdenv.hostPlatform;
};
})
}
+2
View File
@@ -2637,6 +2637,8 @@ with pkgs;
ckb-next = libsForQt5.callPackage ../tools/misc/ckb-next { };
clickhouse-lts = callPackage ../by-name/cl/clickhouse/lts.nix { };
cmdpack = callPackages ../tools/misc/cmdpack { };
cocoapods = callPackage ../development/tools/cocoapods { };