From 6e6f2b5e41d18cb6df8e7928eeba6cb48331c480 Mon Sep 17 00:00:00 2001 From: Sheena Artrip Date: Wed, 16 Mar 2016 03:15:55 -0400 Subject: [PATCH] freeradius: optional dependency support, pcap and cap enabled --- pkgs/servers/freeradius/default.nix | 63 ++++++++++++++++++++++++----- 1 file 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";