2024-05-13 21:24:10 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
# dependencies
|
2024-05-13 21:24:10 +00:00
|
|
|
, cyrus_sasl, groff, libsodium, libtool, openssl, systemdMinimal, libxcrypt
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
# for passthru.tests
|
|
|
|
# , nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "openldap";
|
|
|
|
version = "2.6.7";
|
|
|
|
|
|
|
|
src = fetchurl {
|
2024-05-13 21:24:10 +00:00
|
|
|
url =
|
|
|
|
"https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
|
2024-05-02 00:46:19 +00:00
|
|
|
hash = "sha256-zXdfYlyUTteKPaGKA7A7CO6nPIqryXtBuzNumhCVSTA=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: separate "out" and "bin"
|
2024-05-13 21:24:10 +00:00
|
|
|
outputs = [ "out" "dev" "man" "devdoc" ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
nativeBuildInputs = [ groff ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
buildInputs =
|
|
|
|
[ (cyrus_sasl.override { inherit openssl; }) libsodium libtool openssl ]
|
|
|
|
++ lib.optionals (stdenv.isLinux) [
|
|
|
|
libxcrypt # causes linking issues on *-darwin
|
|
|
|
systemdMinimal
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
preConfigure = lib.optionalString
|
|
|
|
(lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
|
|
|
|
MACOSX_DEPLOYMENT_TARGET=10.16
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-argon2"
|
|
|
|
"--enable-crypt"
|
|
|
|
"--enable-modules"
|
|
|
|
"--enable-overlays"
|
|
|
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
|
|
|
"--with-yielding_select=yes"
|
|
|
|
"ac_cv_func_memcmp_working=yes"
|
|
|
|
] ++ lib.optional stdenv.isFreeBSD "--with-pic";
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ ''-DLDAPI_SOCK="/run/openldap/ldapi"'' ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
makeFlags = [
|
2024-05-02 00:46:19 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
2024-05-13 21:24:10 +00:00
|
|
|
"STRIP=" # Disable install stripping as it breaks cross-compiling. We strip binaries anyway in fixupPhase.
|
2024-05-02 00:46:19 +00:00
|
|
|
"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"
|
|
|
|
|
|
|
|
# skip flaky tests
|
|
|
|
rm -f tests/scripts/test063-delta-multiprovider
|
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
# The directory is empty and serve no purpose.
|
|
|
|
preFixup = ''
|
|
|
|
rm -r $out/var
|
|
|
|
'';
|
|
|
|
|
|
|
|
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}
|
|
|
|
'';
|
|
|
|
|
|
|
|
# passthru.tests = {
|
|
|
|
# inherit (nixosTests) openldap;
|
|
|
|
# };
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://www.openldap.org/";
|
2024-05-13 21:24:10 +00:00
|
|
|
description =
|
|
|
|
"An open source implementation of the Lightweight Directory Access Protocol";
|
2024-05-02 00:46:19 +00:00
|
|
|
license = licenses.openldap;
|
2024-05-13 19:05:39 +00:00
|
|
|
# maintainers = with maintainers; [ hexa ] ++ teams.helsinki-systems.members;
|
2024-05-02 00:46:19 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|