1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-28 16:42:09 +00:00
nixpkgs/pkgs/tools/filesystems/ceph/generic.nix

174 lines
4.4 KiB
Nix
Raw Normal View History

{ stdenv, ensureNewerSourcesHook, cmake, pkgconfig
, which, git
, boost, python2Packages
, libxml2, zlib
, openldap, lttng-ust
, babeltrace, gperf
, cunit, snappy
, rocksdb, makeWrapper
2015-04-21 22:57:48 +01:00
# Optional Dependencies
, yasm ? null, fcgi ? null, expat ? null
, curl ? null, fuse ? null
2015-04-21 22:57:48 +01:00
, libedit ? null, libatomic_ops ? null, kinetic-cpp-client ? null
, libs3 ? null
2015-04-21 22:57:48 +01: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
, version, src ? [], buildInputs ? []
, ...
}:
2015-04-21 22:57:48 +01:00
# We must have one crypto library
assert cryptopp != null || (nss != null && nspr != null);
2015-06-25 02:25:53 +01:00
with stdenv;
with stdenv.lib;
let
2015-06-25 02:25:53 +01:00
shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value;
in if lib.any (lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms
then pkg else null;
2015-06-25 02:25:53 +01:00
optYasm = shouldUsePkg yasm;
optFcgi = shouldUsePkg fcgi;
optExpat = shouldUsePkg expat;
optCurl = shouldUsePkg curl;
optFuse = shouldUsePkg fuse;
optLibedit = shouldUsePkg libedit;
optLibatomic_ops = shouldUsePkg libatomic_ops;
optKinetic-cpp-client = shouldUsePkg kinetic-cpp-client;
2015-08-02 02:05:40 +01:00
optLibs3 = if versionAtLeast version "10.0.0" then null else shouldUsePkg libs3;
2015-06-25 02:25:53 +01: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;
hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
2015-04-21 22:57:48 +01:00
2015-04-22 20:34:34 +01:00
# TODO: Reenable when kinetic support is fixed
2015-06-25 02:25:53 +01:00
#hasKinetic = versionAtLeast version "9.0.0" && optKinetic-cpp-client != null;
hasKinetic = false;
2015-04-22 20:34:34 +01:00
2015-04-21 22:57:48 +01:00
# Malloc implementation (can be jemalloc, tcmalloc or null)
2015-06-25 02:25:53 +01:00
malloc = if optJemalloc != null then optJemalloc else optGperftools;
2015-04-21 22:57:48 +01:00
# We prefer nss over cryptopp
2015-06-25 02:25:53 +01:00
cryptoStr = if optNss != null && optNspr != null then "nss" else
if optCryptopp != null then "cryptopp" else "none";
2015-04-21 22:57:48 +01:00
cryptoLibsMap = {
2015-06-25 02:25:53 +01:00
nss = [ optNss optNspr ];
cryptopp = [ optCryptopp ];
2015-04-21 22:57:48 +01:00
none = [ ];
};
ceph-python-env = python2Packages.python.withPackages (ps: [
ps.sphinx
ps.flask
ps.cython
ps.setuptools
ps.pip
# Libraries needed by the python tools
ps.Mako
ps.pecan
ps.prettytable
ps.webob
ps.cherrypy
]);
in
2015-04-20 20:01:40 +01: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 makeWrapper
2016-03-03 16:55:17 +00:00
(ensureNewerSourcesHook { year = "1980"; })
];
2015-04-22 20:34:34 +01:00
buildInputs = buildInputs ++ cryptoLibsMap.${cryptoStr} ++ [
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
malloc zlib openldap lttng-ust babeltrace gperf cunit
snappy rocksdb
] ++ optionals stdenv.isLinux [
2015-06-25 02:25:53 +01:00
linuxHeaders libuuid udev keyutils optLibaio optLibxfs optZfs
] ++ optionals hasRadosgw [
2015-06-25 02:25:53 +01:00
optFcgi optExpat optCurl optFuse optLibedit
] ++ optionals hasKinetic [
2015-06-25 02:25:53 +01: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 22:57:48 +01: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 22:57:48 +01:00
];
postFixup = ''
wrapPythonPrograms
wrapProgram $out/bin/ceph-mgr --set PYTHONPATH $out/${python2Packages.python.sitePackages}
'';
enableParallelBuilding = true;
outputs = [ "dev" "lib" "out" "doc" ];
meta = {
homepage = https://ceph.com/;
description = "Distributed storage system";
license = licenses.lgpl21;
maintainers = with maintainers; [ adev ak ];
platforms = platforms.unix;
};
passthru.version = version;
}