2022-05-18 00:57:29 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
|
|
|
|
# dependencies
|
2021-02-19 00:35:39 +00:00
|
|
|
, cyrus_sasl
|
2022-05-18 00:57:29 +00:00
|
|
|
, groff
|
|
|
|
, libsodium
|
|
|
|
, libtool
|
|
|
|
, openssl
|
|
|
|
, systemdMinimal
|
2022-09-27 01:17:07 +00:00
|
|
|
, libxcrypt
|
2023-02-15 13:11:52 +00:00
|
|
|
|
|
|
|
# passthru
|
|
|
|
, nixosTests
|
2021-02-19 00:35:39 +00:00
|
|
|
}:
|
2007-01-11 21:55:29 +00:00
|
|
|
|
2012-07-02 19:53:57 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-11-17 16:38:02 +00:00
|
|
|
pname = "openldap";
|
2024-05-22 07:08:35 +00:00
|
|
|
version = "2.6.8";
|
2012-07-02 19:53:57 +00:00
|
|
|
|
2007-01-11 21:55:29 +00:00
|
|
|
src = fetchurl {
|
2020-11-17 16:38:02 +00:00
|
|
|
url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
|
2024-05-22 07:08:35 +00:00
|
|
|
hash = "sha256-SJaTI+lOO+OwPGoTKULcun741UXyrTVAFwkBn2lsPE4=";
|
2007-01-11 21:55:29 +00:00
|
|
|
};
|
2012-07-02 19:53:57 +00:00
|
|
|
|
2015-10-18 13:07:03 +00:00
|
|
|
# TODO: separate "out" and "bin"
|
2022-05-18 00:57:29 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
"man"
|
|
|
|
"devdoc"
|
|
|
|
];
|
2015-07-26 22:25:53 +00:00
|
|
|
|
2023-05-19 20:04:13 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2016-09-01 09:31:39 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
groff
|
|
|
|
];
|
2018-12-10 20:05:12 +00:00
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
buildInputs = [
|
2022-12-04 23:34:24 +00:00
|
|
|
(cyrus_sasl.override {
|
|
|
|
inherit openssl;
|
|
|
|
})
|
2022-05-18 00:57:29 +00:00
|
|
|
libsodium
|
|
|
|
libtool
|
|
|
|
openssl
|
|
|
|
] ++ lib.optionals (stdenv.isLinux) [
|
2022-10-20 07:50:42 +00:00
|
|
|
libxcrypt # causes linking issues on *-darwin
|
2022-05-18 00:57:29 +00:00
|
|
|
systemdMinimal
|
2020-06-25 00:38:06 +00:00
|
|
|
];
|
2018-12-10 20:05:12 +00:00
|
|
|
|
2021-02-25 03:49:07 +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 = [
|
2022-05-18 00:57:29 +00:00
|
|
|
"--enable-argon2"
|
2018-12-10 20:05:12 +00:00
|
|
|
"--enable-crypt"
|
2022-05-18 00:57:29 +00:00
|
|
|
"--enable-modules"
|
|
|
|
"--enable-overlays"
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
2018-12-10 20:05:12 +00:00
|
|
|
"--with-yielding_select=yes"
|
|
|
|
"ac_cv_func_memcmp_working=yes"
|
2022-05-18 00:57:29 +00:00
|
|
|
] ++ lib.optional stdenv.isFreeBSD "--with-pic";
|
|
|
|
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-DLDAPI_SOCK=\"/run/openldap/ldapi\"" ];
|
2022-06-04 15:39:35 +00:00
|
|
|
|
|
|
|
makeFlags= [
|
2022-05-18 00:57:29 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
|
2022-06-04 15:39:35 +00:00
|
|
|
"STRIP_OPTS="
|
2022-05-18 00:57:29 +00:00
|
|
|
"prefix=${placeholder "out"}"
|
2022-07-19 12:31:11 +00:00
|
|
|
"sysconfdir=/etc"
|
2022-05-18 00:57:29 +00:00
|
|
|
"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"
|
|
|
|
];
|
2009-02-12 19:51:51 +00:00
|
|
|
|
2020-02-05 17:16:57 +00:00
|
|
|
postBuild = ''
|
2022-05-27 22:41:18 +00:00
|
|
|
for module in $extraContribModules; do
|
2022-05-18 00:57:29 +00:00
|
|
|
make $makeFlags CC=$CC -C contrib/slapd-modules/$module
|
|
|
|
done
|
2020-02-05 17:16:57 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
preCheck = ''
|
|
|
|
substituteInPlace tests/scripts/all \
|
|
|
|
--replace "/bin/rm" "rm"
|
2023-07-14 16:00:56 +00:00
|
|
|
|
|
|
|
# skip flaky tests
|
|
|
|
rm -f tests/scripts/test063-delta-multiprovider
|
2024-01-30 15:34:05 +00:00
|
|
|
|
|
|
|
# https://bugs.openldap.org/show_bug.cgi?id=10009
|
|
|
|
# can probably be re-added once https://github.com/cyrusimap/cyrus-sasl/pull/772
|
|
|
|
# has made it to a release
|
|
|
|
rm -f tests/scripts/test076-authid-rewrite
|
2022-05-18 00:57:29 +00:00
|
|
|
'';
|
2018-04-25 03:20:18 +00:00
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
doCheck = true;
|
2017-01-10 16:41:09 +00:00
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
# The directory is empty and serve no purpose.
|
2015-05-05 16:02:18 +00:00
|
|
|
preFixup = ''
|
2021-02-19 00:35:39 +00:00
|
|
|
rm -r $out/var
|
2015-05-05 16:02:18 +00:00
|
|
|
'';
|
|
|
|
|
2022-05-18 00:57:29 +00:00
|
|
|
installFlags = [
|
|
|
|
"prefix=${placeholder "out"}"
|
2022-07-19 12:31:11 +00:00
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
2022-05-18 00:57:29 +00:00
|
|
|
"moduledir=${placeholder "out"}/lib/modules"
|
|
|
|
"INSTALL=install"
|
|
|
|
];
|
|
|
|
|
2016-10-06 07:51:21 +00:00
|
|
|
postInstall = ''
|
2022-05-27 22:41:18 +00:00
|
|
|
for module in $extraContribModules; do
|
2022-05-18 00:57:29 +00:00
|
|
|
make $installFlags install -C contrib/slapd-modules/$module
|
|
|
|
done
|
2016-10-29 14:37:48 +00:00
|
|
|
chmod +x "$out"/lib/*.{so,dylib}
|
2016-10-06 07:51:21 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-15 13:11:52 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests) openldap;
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-03-27 23:05:50 +00:00
|
|
|
homepage = "https://www.openldap.org/";
|
2009-02-12 19:51:51 +00:00
|
|
|
description = "Open source implementation of the Lightweight Directory Access Protocol";
|
2018-08-17 22:03:01 +00:00
|
|
|
license = licenses.openldap;
|
2023-11-17 12:35:31 +00:00
|
|
|
maintainers = with maintainers; [ hexa ] ++ teams.helsinki-systems.members;
|
2022-06-04 20:45:41 +00:00
|
|
|
platforms = platforms.unix;
|
2009-02-12 19:51:51 +00:00
|
|
|
};
|
2007-01-11 21:55:29 +00:00
|
|
|
}
|