diff --git a/pkgs/by-name/cl/clickhouse/generic.nix b/pkgs/by-name/cl/clickhouse/generic.nix index 45b91d2415d4..5de42b88490c 100644 --- a/pkgs/by-name/cl/clickhouse/generic.nix +++ b/pkgs/by-name/cl/clickhouse/generic.nix @@ -63,63 +63,60 @@ llvmPackages_19.stdenv.mkDerivation (finalAttrs: { }; 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 - ]; + 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/ - patchShebangs utils/ + postPatch = '' + patchShebangs src/ utils/ - sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt + sed -i 's|/usr/bin/env perl|"${lib.getExe perl}"|' contrib/openssl-cmake/CMakeLists.txt - substituteInPlace src/Storages/System/StorageSystemLicenses.sh utils/list-licenses/list-licenses.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' - '' - + lib.optionalString rustSupport '' - cargoSetupPostPatchHook() { true; } - ''; + substituteInPlace src/Storages/System/StorageSystemLicenses.sh utils/list-licenses/list-licenses.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"; + 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/"; @@ -137,19 +134,16 @@ llvmPackages_19.stdenv.mkDerivation (finalAttrs: { hardeningDisable = [ "fortify" ]; postInstall = '' - rm -rf $out/share/clickhouse-test - 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-fail "/var/log/clickhouse-server/clickhouse-server.err.log" "1" - substituteInPlace $out/etc/clickhouse-server/config.xml \ + --replace-fail "/var/log/clickhouse-server/clickhouse-server.err.log" "1" \ --replace-fail "trace" "warning" ''; # Basic smoke test doCheck = true; - checkPhase = '' + checkPhase = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' $NIX_BUILD_TOP/$sourceRoot/build/programs/clickhouse local --query 'SELECT 1' | grep 1 '';