summary refs log tree commit diff
path: root/pkgs/servers/freeradius/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/servers/freeradius/default.nix')
-rw-r--r--pkgs/servers/freeradius/default.nix64
1 files changed, 53 insertions, 11 deletions
diff --git a/pkgs/servers/freeradius/default.nix b/pkgs/servers/freeradius/default.nix
index 818cc30b054..15bda5d3090 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";
@@ -33,6 +74,7 @@ stdenv.mkDerivation rec {
     homepage = http://freeradius.org/;
     description = "A modular, high performance free RADIUS suite";
     license = stdenv.lib.licenses.gpl2;
+    maintainers = with maintainers; [ sheenobu ];
   };
 
 }