summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2016-03-16 23:50:36 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2016-03-16 23:50:36 +0100
commit2c19812cc9826e5f060a258a1e07568d4eeca69c (patch)
tree39932527aa6be46dbc9c806ee17dd82894f8d86b /pkgs
parentc2013ea4ec9e6c5fbf9bf1e36259eff3283030d1 (diff)
parent6e6f2b5e41d18cb6df8e7928eeba6cb48331c480 (diff)
downloadnixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar.gz
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar.bz2
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar.lz
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar.xz
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.tar.zst
nixlib-2c19812cc9826e5f060a258a1e07568d4eeca69c.zip
Merge pull request #13952 from sheenobu/freeradius/modules
freeradius: optional dependency support, pcap and cap enabled
Diffstat (limited to 'pkgs')
-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";