parent
aecec219d4
commit
8f634a78b9
@ -0,0 +1,75 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
let |
||||
cfg = config.services.clickhouse; |
||||
confDir = "/etc/clickhouse-server"; |
||||
stateDir = "/var/lib/clickhouse"; |
||||
in |
||||
with lib; |
||||
{ |
||||
|
||||
###### interface |
||||
|
||||
options = { |
||||
|
||||
services.clickhouse = { |
||||
|
||||
enable = mkOption { |
||||
default = false; |
||||
description = "Whether to enable ClickHouse database server."; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
}; |
||||
|
||||
|
||||
###### implementation |
||||
|
||||
config = mkIf cfg.enable { |
||||
|
||||
users.extraUsers.clickhouse = { |
||||
name = "clickhouse"; |
||||
uid = config.ids.uids.clickhouse; |
||||
group = "clickhouse"; |
||||
description = "ClickHouse server user"; |
||||
}; |
||||
|
||||
users.extraGroups.clickhouse.gid = config.ids.gids.clickhouse; |
||||
|
||||
systemd.services.clickhouse = { |
||||
description = "ClickHouse server"; |
||||
|
||||
wantedBy = [ "multi-user.target" ]; |
||||
|
||||
after = [ "network.target" ]; |
||||
|
||||
preStart = '' |
||||
mkdir -p ${stateDir} |
||||
chown clickhouse:clickhouse ${confDir} ${stateDir} |
||||
''; |
||||
|
||||
script = '' |
||||
cd "${confDir}" |
||||
exec ${pkgs.clickhouse}/bin/clickhouse-server |
||||
''; |
||||
|
||||
serviceConfig = { |
||||
User = "clickhouse"; |
||||
Group = "clickhouse"; |
||||
PermissionsStartOnly = true; |
||||
}; |
||||
}; |
||||
|
||||
environment.etc = { |
||||
"clickhouse-server/config.xml" = { |
||||
source = "${pkgs.clickhouse}/etc/clickhouse-server/config.xml"; |
||||
}; |
||||
|
||||
"clickhouse-server/users.xml" = { |
||||
source = "${pkgs.clickhouse}/etc/clickhouse-server/users.xml"; |
||||
}; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
} |
@ -0,0 +1,34 @@ |
||||
{ stdenv, fetchFromGitHub, cmake, libtool, boost, double_conversion, gperftools, icu, libmysql, lz4, openssl, poco, re2, readline, sparsehash, unixODBC, zookeeper_mt, zstd }: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
name = "clickhouse-${version}"; |
||||
|
||||
version = "1.1.54190"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "yandex"; |
||||
repo = "ClickHouse"; |
||||
rev = "v${version}-stable"; |
||||
sha256 = "03snzrhz3ai66fqy3rh89cgmpiaskg3077zflkwzqxwx69jkmqix"; |
||||
}; |
||||
|
||||
patches = [ ./prefix.patch ./termcap.patch ]; |
||||
|
||||
nativeBuildInputs = [ cmake libtool ]; |
||||
|
||||
buildInputs = [ boost double_conversion gperftools icu libmysql lz4 openssl poco re2 readline sparsehash unixODBC zookeeper_mt zstd ]; |
||||
|
||||
cmakeFlags = [ "-DENABLE_TESTS=OFF" "-DUNBUNDLED=ON" "-DUSE_STATIC_LIBRARIES=OFF" ]; |
||||
|
||||
NIX_CFLAGS_COMPILE = [ "-Wno-error=unused-function" ]; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
meta = with stdenv.lib; { |
||||
homepage = https://clickhouse.yandex/; |
||||
description = "Column-oriented database management system"; |
||||
license = licenses.asl20; |
||||
maintainers = with maintainers; [ orivej ]; |
||||
platforms = platforms.linux; |
||||
}; |
||||
} |
@ -0,0 +1,30 @@ |
||||
From ccc3596aa3ca041f457bf44d3437d935f56e82a4 Mon Sep 17 00:00:00 2001
|
||||
From: Orivej Desh <orivej@gmx.fr>
|
||||
Date: Sun, 26 Mar 2017 23:57:32 +0000
|
||||
Subject: [PATCH] Do not override CMAKE_INSTALL_PREFIX
|
||||
|
||||
---
|
||||
CMakeLists.txt | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 517b25e..6d8ced2 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -141,12 +141,7 @@ if (ENABLE_TESTS)
|
||||
endif (ENABLE_TESTS)
|
||||
|
||||
# Installation prefix
|
||||
-if (NOT CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||
- set (CMAKE_INSTALL_PREFIX /usr)
|
||||
- set (CLICKHOUSE_ETC_DIR /etc)
|
||||
-else ()
|
||||
- set (CLICKHOUSE_ETC_DIR ${CMAKE_INSTALL_PREFIX}/etc)
|
||||
-endif ()
|
||||
+set (CLICKHOUSE_ETC_DIR ${CMAKE_INSTALL_PREFIX}/etc)
|
||||
|
||||
|
||||
option (UNBUNDLED "Try find all libraries in system (if fail - use bundled from contrib/)" OFF)
|
||||
--
|
||||
2.12.0
|
||||
|
@ -0,0 +1,25 @@ |
||||
From c2105ecdf6a6cc1fbb4c1ae01475db6a65fee32f Mon Sep 17 00:00:00 2001
|
||||
From: Orivej Desh <orivej@gmx.fr>
|
||||
Date: Mon, 27 Mar 2017 01:39:11 +0000
|
||||
Subject: [PATCH] Search for termcap in ncurses
|
||||
|
||||
---
|
||||
cmake/find_readline_edit.cmake | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cmake/find_readline_edit.cmake b/cmake/find_readline_edit.cmake
|
||||
index 26f2768..f520ece 100644
|
||||
--- a/cmake/find_readline_edit.cmake
|
||||
+++ b/cmake/find_readline_edit.cmake
|
||||
@@ -7,7 +7,7 @@ endif ()
|
||||
|
||||
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.2)
|
||||
|
||||
-find_library (TERMCAP_LIB NAMES termcap)
|
||||
+find_library (TERMCAP_LIB NAMES ncurses)
|
||||
find_library (EDIT_LIB NAMES edit)
|
||||
|
||||
set(READLINE_INCLUDE_PATHS "/var/empty/local/var/empty/readline/include")
|
||||
--
|
||||
2.12.0
|
||||
|
Loading…
Reference in new issue