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

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

142 lines
3.3 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
# dependencies
, cyrus_sasl
, 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";
2024-05-22 07:08:35 +00:00
version = "2.6.8";
2012-07-02 19:53:57 +00:00
src = fetchurl {
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=";
};
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
__darwinAllowLocalNetworking = true;
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;
})
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"
openldap: disable flaky test 063 This disables a flaky tests which sometimes fails (most likely due to some race condition). It's also disabled for Debian since 2.5.13: https://launchpad.net/debian/+source/openldap/2.5.13+dfsg-3 For reference, the failure looks like this: >>>>> 00:13:52 Starting test063-delta-multiprovider for mdb... running defines.sh Initializing server configurations... Starting server 1 on TCP/IP port 9011... Using ldapsearch to check that server 1 is running... Using ldapadd for context on server 1... Starting server 2 on TCP/IP port 9012... Using ldapsearch to check that server 2 is running... Starting server 3 on TCP/IP port 9013... Using ldapsearch to check that server 3 is running... Starting server 4 on TCP/IP port 9014... Using ldapsearch to check that server 4 is running... Using ldapadd to populate server 1... Waiting 7 seconds for syncrepl to receive changes... Using ldapsearch to read all the entries from server 1... Using ldapsearch to read all the entries from server 2... Using ldapsearch to read all the entries from server 3... Using ldapsearch to read all the entries from server 4... Comparing retrieved entries from server 1 and server 2... Comparing retrieved entries from server 1 and server 3... Comparing retrieved entries from server 1 and server 4... test failed - server 1 and server 4 databases differ >>>>> 00:14:25 Failed test063-delta-multiprovider for mdb after 33 seconds (exit 1) make[2]: *** [Makefile:320: mdb-yes] Error 1 make[2]: Leaving directory '/build/openldap-2.6.4/tests' make[1]: *** [Makefile:287: test] Error 2 make[1]: Leaving directory '/build/openldap-2.6.4/tests' make: *** [Makefile:298: test] Error 2 error: builder for '/nix/store/ypmpgzfjc992x24h8ga7xvbmk24qbfml-openldap-2.6.4.drv' failed with exit code 2;
2023-07-14 16:00:56 +00:00
# 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.
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 = "Open source implementation of the Lightweight Directory Access Protocol";
2018-08-17 22:03:01 +00:00
license = licenses.openldap;
maintainers = with maintainers; [ hexa ] ++ teams.helsinki-systems.members;
platforms = platforms.unix;
};
}