nixpkgs/pkgs/servers/freeradius/default.nix

105 lines
2.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, talloc, finger_bsd, perl
, openssl
, linkOpenssl? true
, openldap
2017-01-26 02:00:26 +00:00
, withLdap ? true
, sqlite
2017-01-26 02:00:26 +00:00
, withSqlite ? true
, libpcap
, withPcap ? true
, libcap
, withCap ? true
, libmemcached
, withMemcached ? false
, hiredis
, withRedis ? false
, libmysqlclient
, withMysql ? false
, json_c
, withJson ? false
, libyubikey
, withYubikey ? false
, collectd
, withCollectd ? false
, curl
, withRest ? false
}:
2016-03-13 07:22:27 +00:00
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 -> libmysqlclient != null;
assert withYubikey -> libyubikey != null;
assert withCollectd -> collectd != null;
assert withRest -> curl != null && withJson;
2016-03-13 07:22:27 +00:00
## TODO: include windbind optionally (via samba?)
## TODO: include oracle optionally
## TODO: include ykclient optionally
2021-01-15 07:07:56 +00:00
with lib;
2016-03-13 07:22:27 +00:00
stdenv.mkDerivation rec {
pname = "freeradius";
version = "3.0.25";
2016-03-13 07:22:27 +00:00
2017-01-26 02:00:26 +00:00
src = fetchurl {
url = "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-${version}.tar.gz";
sha256 = "SIOmi7PO5GAlNZqXwWkc5lXour/W3DwCHQDhCaL/TBA=";
2017-01-26 02:00:26 +00:00
};
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ openssl talloc finger_bsd perl ]
++ optional withLdap openldap
++ optional withSqlite sqlite
++ optional withPcap libpcap
++ optional withCap libcap
++ optional withMemcached libmemcached
++ optional withRedis hiredis
++ optional withMysql libmysqlclient
++ optional withJson json_c
++ optional withYubikey libyubikey
++ optional withCollectd collectd
++ optional withRest curl;
2016-03-13 07:22:27 +00:00
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
] ++ optional (!linkOpenssl) "--with-openssl=no";
2016-03-13 07:22:27 +00:00
postPatch = ''
substituteInPlace src/main/checkrad.in --replace "/usr/bin/finger" "${finger_bsd}/bin/finger"
'';
2020-02-28 09:50:43 +00:00
# By default, freeradius will generate Diffie-Hellman parameters and
# self-signed TLS certificates during installation. We don't want
# this, for several reasons:
# - reproducibility (random generation)
# - we don't want _anybody_ to use a cert where the private key is on our public binary cache!
# - we don't want the certs to change each time the package is rebuilt
# So let's avoid anything getting into our output.
makeFlags = [ "LOCAL_CERT_FILES=" ];
2016-03-13 07:22:27 +00:00
installFlags = [
"sysconfdir=\${out}/etc"
"localstatedir=\${TMPDIR}"
2020-02-28 09:50:43 +00:00
"INSTALL_CERT_FILES=" # see comment at makeFlags
];
2016-03-13 07:22:27 +00:00
outputs = [ "out" "dev" "man" "doc" ];
meta = with lib; {
homepage = "https://freeradius.org/";
2016-03-13 07:22:27 +00:00
description = "A modular, high performance free RADIUS suite";
2017-09-01 23:08:07 +00:00
license = licenses.gpl2;
2020-02-27 17:07:55 +00:00
maintainers = with maintainers; [ sheenobu willibutz fpletz lheckemann elseym ];
platforms = with platforms; linux;
2016-03-13 07:22:27 +00:00
};
}