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

178 lines
4.5 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 21:57:48 +00:00
# Optional Dependencies
, yasm ? null, fcgi ? null, expat ? null
2017-07-23 14:47:13 +00:00
, curl ? null, fuse ? null, libibverbs ? null, librdmacm ? null
2015-04-21 21:57:48 +00:00
, libedit ? null, libatomic_ops ? null, kinetic-cpp-client ? null
, libs3 ? null
2015-04-21 21:57:48 +00: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 19:34:34 +00:00
, version, src, patches ? [], buildInputs ? []
, ...
}:
2015-04-21 21:57:48 +00:00
# We must have one crypto library
assert cryptopp != null || (nss != null && nspr != null);
2015-06-25 01:25:53 +00:00
with stdenv;
with stdenv.lib;
let
2015-06-25 01:25:53 +00: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 01:05:40 +00:00
optLibs3 = if versionAtLeast version "10.0.0" then null else shouldUsePkg libs3;
2015-06-25 01:25:53 +00: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 01:25:53 +00:00
hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
2015-04-21 21:57:48 +00:00
2015-04-22 19:34:34 +00:00
# TODO: Reenable when kinetic support is fixed
2015-06-25 01:25:53 +00:00
#hasKinetic = versionAtLeast version "9.0.0" && optKinetic-cpp-client != null;
hasKinetic = false;
2015-04-22 19:34:34 +00:00
2015-04-21 21:57:48 +00:00
# Malloc implementation (can be jemalloc, tcmalloc or null)
2015-06-25 01:25:53 +00:00
malloc = if optJemalloc != null then optJemalloc else optGperftools;
2015-04-21 21:57:48 +00:00
# We prefer nss over cryptopp
2015-06-25 01:25:53 +00:00
cryptoStr = if optNss != null && optNspr != null then "nss" else
if optCryptopp != null then "cryptopp" else "none";
2015-04-21 21:57:48 +00:00
cryptoLibsMap = {
2015-06-25 01:25:53 +00:00
nss = [ optNss optNspr ];
cryptopp = [ optCryptopp ];
2015-04-21 21:57:48 +00:00
none = [ ];
};
ceph-python-env = python2Packages.python.withPackages (ps: [
ps.sphinx
ps.flask
ps.argparse
ps.cython
ps.setuptools
ps.pip
# Libraries needed by the python tools
ps.Mako
ps.pecan
ps.prettytable
ps.webob
]);
in
2015-04-20 19:01:40 +00:00
stdenv.mkDerivation {
name="ceph-${version}";
inherit src;
patches = [
# ./ceph-patch-cmake-path.patch
./0001-kv-RocksDBStore-API-break-additional.patch
] ++ optionals stdenv.isLinux [
./0002-fix-absolute-include-path.patch
];
2016-03-03 16:55:17 +00:00
nativeBuildInputs = [
cmake
pkgconfig which git python2Packages.wrapPython
2016-03-03 16:55:17 +00:00
(ensureNewerSourcesHook { year = "1980"; })
];
2015-04-22 19:34:34 +00: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 01:25:53 +00:00
linuxHeaders libuuid udev keyutils optLibaio optLibxfs optZfs
] ++ optionals hasRadosgw [
2015-06-25 01:25:53 +00:00
optFcgi optExpat optCurl optFuse optLibedit
] ++ optionals hasKinetic [
2015-06-25 01:25:53 +00: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 21:57:48 +00: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 21:57:48 +00:00
];
postFixup = ''
wrapPythonPrograms
'';
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;
}