1{
2 lib,
3 stdenv,
4 fetchurl,
5 pkg-config,
6 libgcrypt,
7 libgpg-error,
8 libtasn1,
9
10 # Optional Dependencies
11 pam ? null,
12 libidn ? null,
13 gnutls ? null,
14}:
15
16let
17 shouldUsePkg =
18 pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;
19
20 optPam = shouldUsePkg pam;
21 optLibidn = shouldUsePkg libidn;
22 optGnutls = shouldUsePkg gnutls;
23
24 inherit (lib) enableFeature withFeature optionalString;
25in
26stdenv.mkDerivation rec {
27 pname = "shishi";
28 version = "1.0.2";
29
30 src = fetchurl {
31 url = "mirror://gnu/shishi/shishi-${version}.tar.gz";
32 sha256 = "032qf72cpjdfffq1yq54gz3ahgqf2ijca4vl31sfabmjzq9q370d";
33 };
34
35 separateDebugInfo = true;
36
37 # Fixes support for gcrypt 1.6+
38 patches = [
39 ./gcrypt-fix.patch
40 ./freebsd-unistd.patch
41 ];
42
43 nativeBuildInputs = [ pkg-config ];
44 buildInputs = [
45 libgcrypt
46 libgpg-error
47 libtasn1
48 optPam
49 optLibidn
50 optGnutls
51 ];
52
53 configureFlags = [
54 "--sysconfdir=/etc"
55 "--localstatedir=/var"
56 (enableFeature true "libgcrypt")
57 (enableFeature (optPam != null) "pam")
58 (enableFeature true "ipv6")
59 (withFeature (optLibidn != null) "stringprep")
60 (enableFeature (optGnutls != null) "starttls")
61 (enableFeature true "des")
62 (enableFeature true "3des")
63 (enableFeature true "aes")
64 (enableFeature true "md")
65 (enableFeature false "null")
66 (enableFeature true "arcfour")
67 ];
68
69 env.NIX_CFLAGS_COMPILE = optionalString stdenv.hostPlatform.isDarwin "-DBIND_8_COMPAT";
70
71 doCheck = true;
72
73 installFlags = [ "sysconfdir=\${out}/etc" ];
74
75 # Fix *.la files
76 postInstall = ''
77 sed -i $out/lib/libshi{sa,shi}.la \
78 ''
79 + optionalString (optLibidn != null) ''
80 -e 's,\(-lidn\),-L${optLibidn.out}/lib \1,' \
81 ''
82 + optionalString (optGnutls != null) ''
83 -e 's,\(-lgnutls\),-L${optGnutls.out}/lib \1,' \
84 ''
85 + ''
86 -e 's,\(-lgcrypt\),-L${libgcrypt.out}/lib \1,' \
87 -e 's,\(-lgpg-error\),-L${libgpg-error.out}/lib \1,' \
88 -e 's,\(-ltasn1\),-L${libtasn1.out}/lib \1,'
89 '';
90
91 meta = with lib; {
92 homepage = "https://www.gnu.org/software/shishi/";
93 description = "Implementation of the Kerberos 5 network security system";
94 license = licenses.gpl3Plus;
95 maintainers = with maintainers; [ lovek323 ];
96 platforms = platforms.linux;
97 };
98}