1 { lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, python3, perl, bison, flex
2 , texinfo, perlPackages
3 , openldap, libcap_ng, sqlite, openssl, db, libedit, pam
4 , CoreFoundation, Security, SystemConfiguration
8 stdenv.mkDerivation rec {
12 src = fetchFromGitHub {
15 rev = "heimdal-${version}";
16 sha256 = "099qn9b8q20invvi5r8d8q9rnwpcm3nr89hx5rj7gj2ah2x5vgxs";
19 outputs = [ "out" "dev" "man" "info" ];
21 patches = [ ./heimdal-make-missing-headers.patch ];
23 nativeBuildInputs = [ autoreconfHook pkg-config python3 perl bison flex texinfo ]
24 ++ (with perlPackages; [ JSON ]);
25 buildInputs = optionals (stdenv.isLinux) [ libcap_ng ]
26 ++ [ db sqlite openssl libedit openldap pam]
27 ++ optionals (stdenv.isDarwin) [ CoreFoundation Security SystemConfiguration ];
29 ## ugly, X should be made an option
32 "--localstatedir=/var"
33 "--infodir=$info/share/info"
34 "--enable-hdb-openldap-module"
35 "--with-sqlite3=${sqlite.dev}"
37 # ugly, --with-libedit is not enought, it fall back to bundled libedit
38 "--with-libedit-include=${libedit.dev}/include"
39 "--with-libedit-lib=${libedit}/lib"
40 "--with-openssl=${openssl.dev}"
43 "--with-berkeley-db-include=${db.dev}/include"
44 "--with-openldap=${openldap.dev}"
45 ] ++ optionals (stdenv.isLinux) [
50 sed -i '/^DEFAULT_INCLUDES/ s,$, -I..,' source/cf/Makefile.am.common
51 sed -i -e 's/date/date --date="@$SOURCE_DATE_EPOCH"/' source/configure.ac
55 configureFlagsArray+=(
58 "--libexecdir=$out/libexec/heimdal"
59 "--mandir=$man/share/man"
60 "--infodir=$man/share/info"
61 "--includedir=$dev/include")
64 # We need to build hcrypt for applications like samba
66 (cd include/hcrypto; make -j $NIX_BUILD_CORES)
67 (cd lib/hcrypto; make -j $NIX_BUILD_CORES)
72 (cd include/hcrypto; make -j $NIX_BUILD_CORES install)
73 (cd lib/hcrypto; make -j $NIX_BUILD_CORES install)
79 mv $out/bin/krb5-config $dev/bin/
81 # asn1 compilers, move them to $dev
82 mv $out/libexec/heimdal/heimdal/* $dev/bin
83 rmdir $out/libexec/heimdal/heimdal
85 # compile_et is needed for cross-compiling this package and samba
86 mv lib/com_err/.libs/compile_et $dev/bin
90 # In file included from hxtool.c:34:0:
91 # hx_locl.h:67:25: fatal error: pkcs10_asn1.h: No such file or directory
92 #enableParallelBuilding = true;
95 description = "An implementation of Kerberos 5 (and some more stuff)";
96 license = licenses.bsd3;
97 platforms = platforms.unix;
100 passthru.implementation = "heimdal";