nixpkgs/pkgs/tools/filesystems/ceph/generic.nix

166 lines
4.2 KiB
Nix
Raw Normal View History

{ stdenv, ensureNewerSourcesHook, cmake, pkgconfig
, which, git
, boost, python2Packages
, libxml2, zlib
, openldap, lttngUst
, babeltrace, gperf
, cunit, snappy
, rocksdb
2015-04-21 23:57:48 +02:00
# Optional Dependencies
, yasm ? null, fcgi ? null, expat ? null
2017-07-23 16:47:13 +02:00
, curl ? null, fuse ? null, libibverbs ? null, librdmacm ? null
2015-04-21 23:57:48 +02:00
, libedit ? null, libatomic_ops ? null, kinetic-cpp-client ? null
, libs3 ? null
2015-04-21 23:57:48 +02:00
# Mallocs
, jemalloc ? null, gperftools ? null
# Crypto Dependencies
, cryptopp ? null
, nss ? null, nspr ? null
# Linux Only Dependencies
, linuxHeaders, libuuid, udev, keyutils, libaio ? null, libxfs ? null
, zfs ? null
# Version specific arguments
2015-04-22 21:34:34 +02:00
, version, src, patches ? [], buildInputs ? []
, ...
}:
2015-04-21 23:57:48 +02:00
# We must have one crypto library
assert cryptopp != null || (nss != null && nspr != null);
2015-06-25 03:25:53 +02:00
with stdenv;
with stdenv.lib;
let
2015-06-25 03:25:53 +02:00
shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value;
in if lib.any (x: x == system) (pkg.meta.platforms or [])
then pkg else null;
optYasm = shouldUsePkg yasm;
optFcgi = shouldUsePkg fcgi;
optExpat = shouldUsePkg expat;
optCurl = shouldUsePkg curl;
optFuse = shouldUsePkg fuse;
optLibibverbs = shouldUsePkg libibverbs;
optLibrdmacm = shouldUsePkg librdmacm;
optLibedit = shouldUsePkg libedit;
optLibatomic_ops = shouldUsePkg libatomic_ops;
optKinetic-cpp-client = shouldUsePkg kinetic-cpp-client;
2015-08-02 03:05:40 +02:00
optLibs3 = if versionAtLeast version "10.0.0" then null else shouldUsePkg libs3;
2015-06-25 03:25:53 +02:00
optJemalloc = shouldUsePkg jemalloc;
optGperftools = shouldUsePkg gperftools;
optCryptopp = shouldUsePkg cryptopp;
optNss = shouldUsePkg nss;
optNspr = shouldUsePkg nspr;
optLibaio = shouldUsePkg libaio;
optLibxfs = shouldUsePkg libxfs;
optZfs = shouldUsePkg zfs;
hasMon = true;
hasMds = true;
hasOsd = true;
2015-06-25 03:25:53 +02:00
hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
2015-04-21 23:57:48 +02:00
2015-04-22 21:34:34 +02:00
# TODO: Reenable when kinetic support is fixed
2015-06-25 03:25:53 +02:00
#hasKinetic = versionAtLeast version "9.0.0" && optKinetic-cpp-client != null;
hasKinetic = false;
2015-04-22 21:34:34 +02:00
2015-04-21 23:57:48 +02:00
# Malloc implementation (can be jemalloc, tcmalloc or null)
2015-06-25 03:25:53 +02:00
malloc = if optJemalloc != null then optJemalloc else optGperftools;
2015-04-21 23:57:48 +02:00
# We prefer nss over cryptopp
2015-06-25 03:25:53 +02:00
cryptoStr = if optNss != null && optNspr != null then "nss" else
if optCryptopp != null then "cryptopp" else "none";
2015-04-21 23:57:48 +02:00
cryptoLibsMap = {
2015-06-25 03:25:53 +02:00
nss = [ optNss optNspr ];
cryptopp = [ optCryptopp ];
2015-04-21 23:57:48 +02:00
none = [ ];
};
ceph-python-env = python2Packages.python.withPackages (ps: [
ps.sphinx
ps.flask
ps.argparse
ps.cython
ps.setuptools
ps.pip
]);
in
2015-04-20 21:01:40 +02:00
stdenv.mkDerivation {
name="ceph-${version}";
inherit src;
patches = [
# ./ceph-patch-cmake-path.patch
./0001-kv-RocksDBStore-API-break-additional.patch
];
2016-03-03 17:55:17 +01:00
nativeBuildInputs = [
cmake
pkgconfig which git
2016-03-03 17:55:17 +01:00
(ensureNewerSourcesHook { year = "1980"; })
];
2015-04-22 21:34:34 +02:00
buildInputs = buildInputs ++ cryptoLibsMap.${cryptoStr} ++ [
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
malloc zlib openldap lttngUst babeltrace gperf cunit
snappy rocksdb
] ++ optionals stdenv.isLinux [
2015-06-25 03:25:53 +02:00
linuxHeaders libuuid udev keyutils optLibaio optLibxfs optZfs
] ++ optionals hasRadosgw [
2015-06-25 03:25:53 +02:00
optFcgi optExpat optCurl optFuse optLibedit
] ++ optionals hasKinetic [
2015-06-25 03:25:53 +02:00
optKinetic-cpp-client
];
preConfigure =''
# rip off submodule that interfer with system libs
rm -rf src/boost
rm -rf src/rocksdb
# require LD_LIBRARY_PATH for cython to find internal dep
export LD_LIBRARY_PATH="$PWD/build/lib:$LD_LIBRARY_PATH"
# requires setuptools due to embedded in-cmake setup.py usage
export PYTHONPATH="${python2Packages.setuptools}/lib/python2.7/site-packages/:$PYTHONPATH"
2015-04-21 23:57:48 +02:00
'';
cmakeFlags = [
"-DENABLE_GIT_VERSION=OFF"
"-DWITH_SYSTEM_BOOST=ON"
"-DWITH_SYSTEM_ROCKSDB=ON"
"-DWITH_LEVELDB=OFF"
# enforce shared lib
"-DBUILD_SHARED_LIBS=ON"
# disable cephfs, cmake build broken for now
"-DWITH_CEPHFS=OFF"
"-DWITH_LIBCEPHFS=OFF"
2015-04-21 23:57:48 +02:00
];
enableParallelBuilding = true;
outputs = [ "dev" "lib" "out" "doc" ];
meta = {
homepage = http://ceph.com/;
description = "Distributed storage system";
license = licenses.lgpl21;
maintainers = with maintainers; [ adev ak wkennington ];
platforms = platforms.unix;
};
passthru.version = version;
}