2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, runCommand, fetchurl
|
2020-04-24 23:36:52 +00:00
|
|
|
, ensureNewerSourcesHook
|
2021-02-05 17:12:51 +00:00
|
|
|
, cmake, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, which, git
|
|
|
|
, boost, python3Packages
|
|
|
|
, libxml2, zlib, lz4
|
|
|
|
, openldap, lttng-ust
|
|
|
|
, babeltrace, gperf
|
|
|
|
, gtest
|
|
|
|
, cunit, snappy
|
2021-02-16 17:04:54 +00:00
|
|
|
, makeWrapper
|
2020-04-24 23:36:52 +00:00
|
|
|
, leveldb, oathToolkit
|
|
|
|
, libnl, libcap_ng
|
2020-07-18 16:06:22 +00:00
|
|
|
, rdkafka
|
2021-02-16 17:04:54 +00:00
|
|
|
, nixosTests
|
2021-04-22 02:08:21 +00:00
|
|
|
, cryptsetup
|
|
|
|
, sqlite
|
|
|
|
, lua
|
|
|
|
, icu
|
|
|
|
, bzip2
|
|
|
|
, doxygen
|
|
|
|
, graphviz
|
|
|
|
, fmt
|
|
|
|
, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Optional Dependencies
|
|
|
|
, yasm ? null, fcgi ? null, expat ? null
|
|
|
|
, curl ? null, fuse ? null
|
|
|
|
, libedit ? null, libatomic_ops ? null
|
|
|
|
, libs3 ? null
|
|
|
|
|
|
|
|
# Mallocs
|
|
|
|
, jemalloc ? null, gperftools ? null
|
|
|
|
|
|
|
|
# Crypto Dependencies
|
|
|
|
, cryptopp ? null
|
|
|
|
, nss ? null, nspr ? null
|
|
|
|
|
|
|
|
# Linux Only Dependencies
|
2020-11-24 20:58:05 +00:00
|
|
|
, linuxHeaders, util-linux, libuuid, udev, keyutils, rdma-core, rabbitmq-c
|
2020-04-24 23:36:52 +00:00
|
|
|
, libaio ? null, libxfs ? null, zfs ? null
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
# We must have one crypto library
|
|
|
|
assert cryptopp != null || (nss != null && nspr != null);
|
|
|
|
|
|
|
|
let
|
|
|
|
shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null;
|
|
|
|
|
|
|
|
optYasm = shouldUsePkg yasm;
|
|
|
|
optFcgi = shouldUsePkg fcgi;
|
|
|
|
optExpat = shouldUsePkg expat;
|
|
|
|
optCurl = shouldUsePkg curl;
|
|
|
|
optFuse = shouldUsePkg fuse;
|
|
|
|
optLibedit = shouldUsePkg libedit;
|
|
|
|
optLibatomic_ops = shouldUsePkg libatomic_ops;
|
|
|
|
optLibs3 = shouldUsePkg libs3;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
# Malloc implementation (can be jemalloc, tcmalloc or null)
|
|
|
|
malloc = if optJemalloc != null then optJemalloc else optGperftools;
|
|
|
|
|
|
|
|
# We prefer nss over cryptopp
|
|
|
|
cryptoStr = if optNss != null && optNspr != null then "nss" else
|
|
|
|
if optCryptopp != null then "cryptopp" else "none";
|
|
|
|
|
|
|
|
cryptoLibsMap = {
|
|
|
|
nss = [ optNss optNspr ];
|
|
|
|
cryptopp = [ optCryptopp ];
|
|
|
|
none = [ ];
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
getMeta = description: with lib; {
|
2020-07-18 16:06:22 +00:00
|
|
|
homepage = "https://ceph.com/";
|
|
|
|
inherit description;
|
|
|
|
license = with licenses; [ lgpl21 gpl2 bsd3 mit publicDomain ];
|
|
|
|
maintainers = with maintainers; [ adev ak johanot krav ];
|
2021-01-09 10:05:03 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ceph-common = python3Packages.buildPythonPackage rec{
|
|
|
|
pname = "ceph-common";
|
|
|
|
inherit src version;
|
|
|
|
|
|
|
|
sourceRoot = "ceph-${version}/src/python-common";
|
|
|
|
|
|
|
|
checkInputs = [ python3Packages.pytest ];
|
|
|
|
propagatedBuildInputs = with python3Packages; [ pyyaml six ];
|
|
|
|
|
|
|
|
meta = getMeta "Ceph common module for code shared by manager modules";
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
ceph-python-env = python3Packages.python.withPackages (ps: [
|
|
|
|
ps.sphinx
|
|
|
|
ps.flask
|
|
|
|
ps.cython
|
|
|
|
ps.setuptools
|
|
|
|
ps.virtualenv
|
|
|
|
# Libraries needed by the python tools
|
|
|
|
ps.Mako
|
2020-07-18 16:06:22 +00:00
|
|
|
ceph-common
|
2020-04-24 23:36:52 +00:00
|
|
|
ps.cherrypy
|
2020-07-18 16:06:22 +00:00
|
|
|
ps.dateutil
|
|
|
|
ps.jsonpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
ps.pecan
|
|
|
|
ps.prettytable
|
2021-04-12 18:23:04 +00:00
|
|
|
ps.pyopenssl
|
2020-04-24 23:36:52 +00:00
|
|
|
ps.pyjwt
|
|
|
|
ps.webob
|
|
|
|
ps.bcrypt
|
2020-07-18 16:06:22 +00:00
|
|
|
# scipy > 1.3 breaks diskprediction_local, leading to mgr hang on startup
|
|
|
|
# Bump (and get rid of scipy_1_3) once these issues are resolved:
|
|
|
|
# https://tracker.ceph.com/issues/42764 https://tracker.ceph.com/issues/45147
|
|
|
|
ps.scipy_1_3
|
2020-04-24 23:36:52 +00:00
|
|
|
ps.six
|
|
|
|
ps.pyyaml
|
|
|
|
]);
|
|
|
|
sitePackages = ceph-python-env.python.sitePackages;
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
version = "16.2.3";
|
2020-07-18 16:06:22 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "http://download.ceph.com/tarballs/ceph-${version}.tar.gz";
|
2021-05-28 09:39:13 +00:00
|
|
|
sha256 = "sha256-K3T1Lob19p8ykYEmYumHS8hqj2uysCuE0EAKb1TMJ0Q=";
|
2020-07-18 16:06:22 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
in rec {
|
|
|
|
ceph = stdenv.mkDerivation {
|
|
|
|
pname = "ceph";
|
2020-07-18 16:06:22 +00:00
|
|
|
inherit src version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./0000-fix-SPDK-build-env.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config which git python3Packages.wrapPython makeWrapper
|
2020-04-24 23:36:52 +00:00
|
|
|
python3Packages.python # for the toPythonPath function
|
|
|
|
(ensureNewerSourcesHook { year = "1980"; })
|
2021-04-22 02:08:21 +00:00
|
|
|
python3
|
|
|
|
fmt
|
|
|
|
# for building docs/man-pages presumably
|
|
|
|
doxygen
|
|
|
|
graphviz
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = cryptoLibsMap.${cryptoStr} ++ [
|
|
|
|
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
|
|
|
|
malloc zlib openldap lttng-ust babeltrace gperf gtest cunit
|
2021-02-16 17:04:54 +00:00
|
|
|
snappy lz4 oathToolkit leveldb libnl libcap_ng rdkafka
|
2021-04-22 02:08:21 +00:00
|
|
|
cryptsetup sqlite lua icu bzip2
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-11-24 20:58:05 +00:00
|
|
|
linuxHeaders util-linux libuuid udev keyutils optLibaio optLibxfs optZfs
|
2020-04-24 23:36:52 +00:00
|
|
|
# ceph 14
|
|
|
|
rdma-core rabbitmq-c
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals hasRadosgw [
|
2020-04-24 23:36:52 +00:00
|
|
|
optFcgi optExpat optCurl optFuse optLibedit
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonPath = [ ceph-python-env "${placeholder "out"}/${ceph-python-env.sitePackages}" ];
|
|
|
|
|
|
|
|
preConfigure =''
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modinfo" "modinfo"
|
|
|
|
substituteInPlace src/common/module.c --replace "/sbin/modprobe" "modprobe"
|
2021-04-25 03:57:28 +00:00
|
|
|
substituteInPlace src/common/module.c --replace "/bin/grep" "grep"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# for pybind/rgw to find internal dep
|
|
|
|
export LD_LIBRARY_PATH="$PWD/build/lib''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"
|
|
|
|
# install target needs to be in PYTHONPATH for "*.pth support" check to succeed
|
|
|
|
# set PYTHONPATH, so the build system doesn't silently skip installing ceph-volume and others
|
|
|
|
export PYTHONPATH=${ceph-python-env}/${sitePackages}:$lib/${sitePackages}:$out/${sitePackages}
|
|
|
|
patchShebangs src/script src/spdk src/test src/tools
|
|
|
|
'';
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-02-16 17:04:54 +00:00
|
|
|
"-DWITH_SYSTEM_ROCKSDB=OFF" # breaks Bluestore
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DCMAKE_INSTALL_DATADIR=${placeholder "lib"}/lib"
|
|
|
|
|
|
|
|
"-DWITH_SYSTEM_BOOST=ON"
|
|
|
|
"-DWITH_SYSTEM_GTEST=ON"
|
|
|
|
"-DMGR_PYTHON_VERSION=${ceph-python-env.python.pythonVersion}"
|
|
|
|
"-DWITH_SYSTEMD=OFF"
|
|
|
|
"-DWITH_TESTS=OFF"
|
|
|
|
# TODO breaks with sandbox, tries to download stuff with npm
|
|
|
|
"-DWITH_MGR_DASHBOARD_FRONTEND=OFF"
|
2021-04-22 02:08:21 +00:00
|
|
|
# WITH_XFS has been set default ON from Ceph 16, keeping it optional in nixpkgs for now
|
|
|
|
''-DWITH_XFS=${if optLibxfs != null then "ON" else "OFF"}''
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapPythonPrograms
|
|
|
|
wrapProgram $out/bin/ceph-mgr --prefix PYTHONPATH ":" "$(toPythonPath ${placeholder "out"}):$(toPythonPath ${ceph-python-env})"
|
|
|
|
|
|
|
|
# Test that ceph-volume exists since the build system has a tendency to
|
|
|
|
# silently drop it with misconfigurations.
|
|
|
|
test -f $out/bin/ceph-volume
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "doc" "man" ];
|
|
|
|
|
|
|
|
doCheck = false; # uses pip to install things from the internet
|
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
# Takes 7+h to build with 2 cores.
|
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
meta = getMeta "Distributed storage system";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
passthru.version = version;
|
2021-02-16 17:04:54 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) ceph-single-node ceph-multi-node ceph-single-node-bluestore; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ceph-client = runCommand "ceph-client-${version}" {
|
2020-07-18 16:06:22 +00:00
|
|
|
meta = getMeta "Tools needed to mount Ceph's RADOS Block Devices";
|
2020-04-24 23:36:52 +00:00
|
|
|
} ''
|
2020-11-21 19:51:51 +00:00
|
|
|
mkdir -p $out/{bin,etc,${sitePackages},share/bash-completion/completions}
|
2020-04-24 23:36:52 +00:00
|
|
|
cp -r ${ceph}/bin/{ceph,.ceph-wrapped,rados,rbd,rbdmap} $out/bin
|
|
|
|
cp -r ${ceph}/bin/ceph-{authtool,conf,dencoder,rbdnamer,syn} $out/bin
|
|
|
|
cp -r ${ceph}/bin/rbd-replay* $out/bin
|
|
|
|
cp -r ${ceph}/${sitePackages} $out/${sitePackages}
|
2020-11-21 19:51:51 +00:00
|
|
|
cp -r ${ceph}/etc/bash_completion.d $out/share/bash-completion/completions
|
2020-04-24 23:36:52 +00:00
|
|
|
# wrapPythonPrograms modifies .ceph-wrapped, so lets just update its paths
|
|
|
|
substituteInPlace $out/bin/ceph --replace ${ceph} $out
|
|
|
|
substituteInPlace $out/bin/.ceph-wrapped --replace ${ceph} $out
|
|
|
|
'';
|
|
|
|
}
|