summary refs log tree commit diff
path: root/pkgs/servers
diff options
context:
space:
mode:
authorSheena Artrip <sheena.artrip@gmail.com>2016-03-16 03:15:55 -0400
committerSheena Artrip <sheena.artrip@gmail.com>2016-03-16 03:15:55 -0400
commit6e6f2b5e41d18cb6df8e7928eeba6cb48331c480 (patch)
tree33d1a8c53905e640ca85ccbbb6841bc4ccf2a964 /pkgs/servers
parent9f944fb642a2d19f4d388e04376878fccdbe6cc7 (diff)
downloadnixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar.gz
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar.bz2
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar.lz
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar.xz
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.tar.zst
nixlib-6e6f2b5e41d18cb6df8e7928eeba6cb48331c480.zip
freeradius: optional dependency support, pcap and cap enabled
Diffstat (limited to 'pkgs/servers')
-rw-r--r--pkgs/servers/freeradius/default.nix63
1 files changed, 52 insertions, 11 deletions
diff --git a/pkgs/servers/freeradius/default.nix b/pkgs/servers/freeradius/default.nix
index a959555684e1..15bda5d3090d 100644
--- a/pkgs/servers/freeradius/default.nix
+++ b/pkgs/servers/freeradius/default.nix
@@ -1,28 +1,69 @@
-{ stdenv, fetchurl, autoreconfHook, talloc, openssl ? null }:
+{ stdenv, fetchurl, autoreconfHook, talloc
+, openssl
+, linkOpenssl? true
+, openldap
+, withLdap ? false
+, sqlite
+, withSqlite ? false
+, libpcap
+, withPcap ? true
+, libcap
+, withCap ? true
+, libmemcached
+, withMemcached ? false
+, hiredis
+, withRedis ? false
+, libmysql
+, withMysql ? false
+, withJson ? false
+, libyubikey
+, withYubikey ? false
+, collectd
+, withCollectd ? false
+}:
 
-## TODO: include ldap optionally
-## TODO: include sqlite optionally
-## TODO: include mysql optionally
+assert withSqlite -> sqlite != null;
+assert withLdap -> openldap != null;
+assert withPcap -> libpcap != null;
+assert withCap -> libcap != null;
+assert withMemcached -> libmemcached != null;
+assert withRedis -> hiredis != null;
+assert withMysql -> libmysql != null;
+assert withYubikey -> libyubikey != null;
+assert withCollectd -> collectd != null;
 
+## TODO: include windbind optionally (via samba?)
+## TODO: include oracle optionally
+## TODO: include ykclient optionally
+
+with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "freeradius-${version}";
   version = "3.0.11";
 
-  buildInputs = [
-    autoreconfHook
-    talloc
-    openssl
-  ];
+  buildInputs = [ autoreconfHook openssl talloc ]
+    ++ optional withLdap [ openldap ]
+    ++ optional withSqlite [ sqlite ]
+    ++ optional withPcap [ libpcap ]
+    ++ optional withCap [ libcap ]
+    ++ optional withMemcached [ libmemcached ]
+    ++ optional withRedis [ hiredis ]
+    ++ optional withMysql [ libmysql ]
+    ++ optional withJson [ pkgs."json-c" ]
+    ++ optional withYubikey [ libyubikey ]
+    ++ optional withCollectd [ collectd ];
+
+  # NOTE: are the --with-{lib}-lib-dir and --with-{lib}-include-dir necessary with buildInputs ?
 
   configureFlags = [
      "--sysconfdir=/etc"
      "--localstatedir=/var"
-  ];
+  ] ++ optional (!linkOpenssl) "--with-openssl=no";
 
   installFlags = [
     "sysconfdir=\${out}/etc"
     "localstatedir=\${TMPDIR}"
-   ];
+  ];
 
   src = fetchurl {
     url = "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${version}.tar.gz";