nixpkgs/pkgs/development/libraries/openldap/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

135 lines
3.0 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
, fetchpatch
# dependencies
, cyrus_sasl
, db
, groff
, libsodium
, libtool
, openssl
, systemdMinimal
2022-09-27 01:17:07 +00:00
, libxcrypt
2023-02-15 13:11:52 +00:00
# passthru
, nixosTests
}:
2012-07-02 19:53:57 +00:00
stdenv.mkDerivation rec {
pname = "openldap";
version = "2.6.4";
2012-07-02 19:53:57 +00:00
src = fetchurl {
url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
hash = "sha256-1RcE5QF4QwwGzz2KoXTaZrrfVZdHpH2SC7VLLUqkCZE=";
};
2012-07-02 19:53:57 +00:00
# TODO: separate "out" and "bin"
outputs = [
"out"
"dev"
"man"
"devdoc"
];
2015-07-26 22:25:53 +00:00
enableParallelBuilding = true;
nativeBuildInputs = [
groff
];
2018-12-10 20:05:12 +00:00
buildInputs = [
2022-12-04 23:34:24 +00:00
(cyrus_sasl.override {
inherit openssl;
})
db
libsodium
libtool
openssl
] ++ lib.optionals (stdenv.isLinux) [
libxcrypt # causes linking issues on *-darwin
systemdMinimal
2020-06-25 00:38:06 +00:00
];
2018-12-10 20:05:12 +00:00
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
MACOSX_DEPLOYMENT_TARGET=10.16
'';
2018-12-10 20:05:12 +00:00
configureFlags = [
"--enable-argon2"
2018-12-10 20:05:12 +00:00
"--enable-crypt"
"--enable-modules"
"--enable-overlays"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
2018-12-10 20:05:12 +00:00
"--with-yielding_select=yes"
"ac_cv_func_memcmp_working=yes"
] ++ lib.optional stdenv.isFreeBSD "--with-pic";
env.NIX_CFLAGS_COMPILE = toString [ "-DLDAPI_SOCK=\"/run/openldap/ldapi\"" ];
makeFlags= [
"CC=${stdenv.cc.targetPrefix}cc"
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
"STRIP_OPTS="
"prefix=${placeholder "out"}"
"sysconfdir=/etc"
"systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
# contrib modules require these
"moduledir=${placeholder "out"}/lib/modules"
"mandir=${placeholder "out"}/share/man"
];
extraContribModules = [
# https://git.openldap.org/openldap/openldap/-/tree/master/contrib/slapd-modules
"passwd/sha2"
"passwd/pbkdf2"
"passwd/totp"
];
postBuild = ''
for module in $extraContribModules; do
make $makeFlags CC=$CC -C contrib/slapd-modules/$module
done
'';
preCheck = ''
substituteInPlace tests/scripts/all \
--replace "/bin/rm" "rm"
'';
doCheck = true;
# The directory is empty and serve no purpose.
2015-05-05 16:02:18 +00:00
preFixup = ''
rm -r $out/var
2015-05-05 16:02:18 +00:00
'';
installFlags = [
"prefix=${placeholder "out"}"
"sysconfdir=${placeholder "out"}/etc"
"moduledir=${placeholder "out"}/lib/modules"
"INSTALL=install"
];
postInstall = ''
for module in $extraContribModules; do
make $installFlags install -C contrib/slapd-modules/$module
done
chmod +x "$out"/lib/*.{so,dylib}
'';
2023-02-15 13:11:52 +00:00
passthru.tests = {
inherit (nixosTests) openldap;
};
meta = with lib; {
homepage = "https://www.openldap.org/";
description = "An open source implementation of the Lightweight Directory Access Protocol";
2018-08-17 22:03:01 +00:00
license = licenses.openldap;
2022-05-18 13:25:34 +00:00
maintainers = with maintainers; [ ajs124 das_j hexa ];
platforms = platforms.unix;
};
}