From 6dbec0e85435c98ac19dc23b05e5e6f7d7e5e30e Mon Sep 17 00:00:00 2001 From: Konstantin Bogdanov Date: Fri, 25 Apr 2025 14:53:27 +0200 Subject: [PATCH] clickhouse: 24.3.7.30 -> 25.3.3.42 --- .../cl/clickhouse/package.nix} | 131 ++++-------------- pkgs/top-level/all-packages.nix | 4 - 2 files changed, 24 insertions(+), 111 deletions(-) rename pkgs/{servers/clickhouse/default.nix => by-name/cl/clickhouse/package.nix} (55%) diff --git a/pkgs/servers/clickhouse/default.nix b/pkgs/by-name/cl/clickhouse/package.nix similarity index 55% rename from pkgs/servers/clickhouse/default.nix rename to pkgs/by-name/cl/clickhouse/package.nix index 3e97c23b1a2a..cb8903eae19c 100644 --- a/pkgs/servers/clickhouse/default.nix +++ b/pkgs/by-name/cl/clickhouse/package.nix @@ -1,9 +1,8 @@ { lib, - llvmPackages, - llvmPackages_16, + stdenv, + llvmPackages_19, fetchFromGitHub, - fetchpatch, cmake, ninja, python3, @@ -14,30 +13,23 @@ darwin, findutils, libiconv, - rustSupport ? true, - rustc, cargo, rustPlatform, }: -let - inherit (llvmPackages) stdenv; - mkDerivation = - (if stdenv.hostPlatform.isDarwin then llvmPackages_16.stdenv else llvmPackages.stdenv).mkDerivation; -in -mkDerivation rec { +llvmPackages_19.stdenv.mkDerivation (finalAttrs: { pname = "clickhouse"; - version = "24.3.7.30"; + version = "25.3.3.42"; src = fetchFromGitHub rec { owner = "ClickHouse"; repo = "ClickHouse"; - rev = "v${version}-lts"; + tag = "v${finalAttrs.version}-lts"; fetchSubmodules = true; - name = "clickhouse-${rev}.tar.gz"; - hash = "sha256-xIqn1cRbuD3NpUC2c7ZzvC8EAmg+XOXCkp+g/HTdIc0="; + name = "clickhouse-${tag}.tar.gz"; + hash = "sha256-VYT6Rnq7LaV9fZc4LJ9YtbWQDgEARYok8MjVfg8itIg="; postFetch = '' # delete files that make the source too big rm -rf $out/contrib/llvm-project/llvm/test @@ -62,20 +54,6 @@ mkDerivation rec { ''; }; - patches = [ - # They updated the Cargo.toml without updating the Cargo.lock :/ - (fetchpatch { - url = "https://github.com/ClickHouse/ClickHouse/commit/bccd33932b5fe17ced2dc2f27813da0b1c034afa.patch"; - revert = true; - hash = "sha256-4idwr+G8WGuT/VILKtDIJIvbCvi6pZokJFze4dP6ExE="; - }) - (fetchpatch { - url = "https://github.com/ClickHouse/ClickHouse/commit/b6bd5ecb199ef8a10e3008a4ea3d96087db8a8c1.patch"; - revert = true; - hash = "sha256-nbb/GV2qWEZ+BEfT6/9//yZf4VWdhOdJCI3PLeh6o0M="; - }) - ]; - strictDeps = true; nativeBuildInputs = [ @@ -83,14 +61,14 @@ mkDerivation rec { ninja python3 perl - llvmPackages.lld + llvmPackages_19.lld ] ++ lib.optionals stdenv.hostPlatform.isx86_64 [ nasm yasm ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - llvmPackages.bintools + llvmPackages_19.bintools findutils darwin.bootstrap_cmds ] @@ -102,101 +80,38 @@ mkDerivation rec { buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; - # their vendored version is too old and missing this patch: https://github.com/corrosion-rs/corrosion/pull/205 - corrosionSrc = - if rustSupport then - fetchFromGitHub { - owner = "corrosion-rs"; - repo = "corrosion"; - rev = "v0.3.5"; - hash = "sha256-r/jrck4RiQynH1+Hx4GyIHpw/Kkr8dHe1+vTHg+fdRs="; - } - else - null; - corrosionDeps = - if rustSupport then - rustPlatform.fetchCargoVendor { - src = corrosionSrc; - name = "corrosion-deps"; - preBuild = "cd generator"; - hash = "sha256-ok1QLobiGBccmbEEWQxHz3ivvuT6FrOgG6wLK4gIbgU="; - } - else - null; - rustDeps = - if rustSupport then - rustPlatform.fetchCargoVendor { - inherit src; - name = "rust-deps"; - preBuild = "cd rust"; - hash = "sha256-nX5wBM8rVMbaf/IrPsqkdT2KQklQbBIGomeWSTjclR4="; - } - else - null; - dontCargoSetupPostUnpack = true; - postUnpack = lib.optionalString rustSupport '' - pushd source - - rm -rf contrib/corrosion - cp -r --no-preserve=mode $corrosionSrc contrib/corrosion - - pushd contrib/corrosion/generator - cargoDeps="$corrosionDeps" cargoSetupPostUnpackHook - corrosionDepsCopy="$cargoDepsCopy" - popd - - pushd rust - cargoDeps="$rustDeps" cargoSetupPostUnpackHook - rustDepsCopy="$cargoDepsCopy" - cat .cargo/config.toml >> .cargo/config.toml.in - cat .cargo/config.toml >> skim/.cargo/config.toml.in - rm .cargo/config.toml - popd - - popd - ''; 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 'git rev-parse --show-toplevel' '$src' - substituteInPlace utils/check-style/check-duplicate-includes.sh \ - --replace 'git rev-parse --show-toplevel' '$src' + --replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot" substituteInPlace utils/check-style/check-ungrouped-includes.sh \ - --replace 'git rev-parse --show-toplevel' '$src' + --replace-fail '$(git rev-parse --show-toplevel)' "$NIX_BUILD_TOP/$sourceRoot" substituteInPlace utils/list-licenses/list-licenses.sh \ - --replace 'git rev-parse --show-toplevel' '$src' - substituteInPlace utils/check-style/check-style \ - --replace 'git rev-parse --show-toplevel' '$src' + --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 - '' - + lib.optionalString rustSupport '' - pushd contrib/corrosion/generator - cargoDepsCopy="$corrosionDepsCopy" cargoSetupPostPatchHook - popd - - pushd rust - cargoDepsCopy="$rustDepsCopy" cargoSetupPostPatchHook - popd - - cargoSetupPostPatchHook() { true; } - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' # 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" "-DENABLE_EMBEDDED_COMPILER=ON" ] @@ -205,6 +120,7 @@ mkDerivation rec { ) "-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" @@ -224,9 +140,9 @@ mkDerivation rec { sed -i -e '\!/var/log/clickhouse-server/clickhouse-server\.log!d' \ $out/etc/clickhouse-server/config.xml substituteInPlace $out/etc/clickhouse-server/config.xml \ - --replace "/var/log/clickhouse-server/clickhouse-server.err.log" "1" + --replace-fail "/var/log/clickhouse-server/clickhouse-server.err.log" "1" substituteInPlace $out/etc/clickhouse-server/config.xml \ - --replace "trace" "warning" + --replace-fail "trace" "warning" ''; # Builds in 7+h with 2 cores, and ~20m with a big-parallel builder. @@ -241,10 +157,11 @@ mkDerivation rec { 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; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 43c0e54c3637..d33792a3b425 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10278,10 +10278,6 @@ with pkgs; autoreconfHook = buildPackages.autoreconfHook269; }; - clickhouse = callPackage ../servers/clickhouse { - llvmPackages = llvmPackages_16; - }; - clickhouse-cli = with python3Packages; toPythonApplication clickhouse-cli; couchdb3 = callPackage ../servers/http/couchdb/3.nix { };