Merge pull request #13952 from sheenobu/freeradius/modules

freeradius: optional dependency support, pcap and cap enabled
This commit is contained in:
Franz Pletz 2016-03-16 23:50:36 +01:00
commit 2c19812cc9

View File

@ -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";