blob: e25f0a8c172d821014af425cb3a439fe43ff9641 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
{ lib
, stdenv
, fetchurl
# dependencies
, cyrus_sasl
, groff
, libsodium
, libtool
, openssl
, systemdMinimal
, libxcrypt
# passthru
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "openldap";
version = "2.6.8";
src = fetchurl {
url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${pname}-${version}.tgz";
hash = "sha256-SJaTI+lOO+OwPGoTKULcun741UXyrTVAFwkBn2lsPE4=";
};
# TODO: separate "out" and "bin"
outputs = [
"out"
"dev"
"man"
"devdoc"
];
__darwinAllowLocalNetworking = true;
enableParallelBuilding = true;
nativeBuildInputs = [
groff
];
buildInputs = [
(cyrus_sasl.override {
inherit openssl;
})
libsodium
libtool
openssl
] ++ lib.optionals (stdenv.isLinux) [
libxcrypt # causes linking issues on *-darwin
systemdMinimal
];
preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
MACOSX_DEPLOYMENT_TARGET=10.16
'';
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";
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"
# 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/";
description = "Open source implementation of the Lightweight Directory Access Protocol";
license = licenses.openldap;
maintainers = with maintainers; [ hexa ] ++ teams.helsinki-systems.members;
platforms = platforms.unix;
};
}
|