2022-01-13 20:06:32 +00:00
|
|
|
|
{ lib
|
|
|
|
|
, stdenv
|
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
|
|
|
|
|
# build time
|
|
|
|
|
, autoreconfHook
|
|
|
|
|
, flex
|
|
|
|
|
, bison
|
|
|
|
|
, perl
|
|
|
|
|
, pkg-config
|
|
|
|
|
, texinfo
|
2023-08-22 20:05:09 +00:00
|
|
|
|
, buildPackages
|
2022-01-13 20:06:32 +00:00
|
|
|
|
|
|
|
|
|
# runtime
|
|
|
|
|
, c-ares
|
|
|
|
|
, json_c
|
|
|
|
|
, libcap
|
|
|
|
|
, libelf
|
|
|
|
|
, libunwind
|
|
|
|
|
, libyang
|
|
|
|
|
, net-snmp
|
|
|
|
|
, openssl
|
|
|
|
|
, pam
|
|
|
|
|
, pcre2
|
|
|
|
|
, python3
|
|
|
|
|
, readline
|
2022-06-16 17:23:12 +00:00
|
|
|
|
, rtrlib
|
2023-10-09 19:29:22 +00:00
|
|
|
|
, protobufc
|
2022-01-13 20:06:32 +00:00
|
|
|
|
|
|
|
|
|
# tests
|
|
|
|
|
, nettools
|
|
|
|
|
, nixosTests
|
2023-08-22 20:05:09 +00:00
|
|
|
|
|
|
|
|
|
# FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host
|
|
|
|
|
# This leads to compilation errors when cross compiling.
|
|
|
|
|
# E.g. net-snmp-config for x86_64 does not return the ARM64 paths.
|
|
|
|
|
#
|
|
|
|
|
# SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
|
|
|
|
|
# SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
|
|
|
|
|
, snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
|
|
|
|
|
|
|
|
|
# other general options besides snmp support
|
|
|
|
|
, rpkiSupport ? true
|
|
|
|
|
, numMultipath ? 64
|
|
|
|
|
, watchfrrSupport ? true
|
|
|
|
|
, cumulusSupport ? false
|
|
|
|
|
, datacenterSupport ? true
|
|
|
|
|
, rtadvSupport ? true
|
|
|
|
|
, irdpSupport ? true
|
|
|
|
|
, routeReplacementSupport ? true
|
2023-10-09 19:29:22 +00:00
|
|
|
|
, mgmtdSupport ? true
|
2023-08-22 20:05:09 +00:00
|
|
|
|
|
|
|
|
|
# routing daemon options
|
|
|
|
|
, bgpdSupport ? true
|
|
|
|
|
, ripdSupport ? true
|
|
|
|
|
, ripngdSupport ? true
|
|
|
|
|
, ospfdSupport ? true
|
|
|
|
|
, ospf6dSupport ? true
|
|
|
|
|
, ldpdSupport ? true
|
|
|
|
|
, nhrpdSupport ? true
|
|
|
|
|
, eigrpdSupport ? true
|
|
|
|
|
, babeldSupport ? true
|
|
|
|
|
, isisdSupport ? true
|
|
|
|
|
, pimdSupport ? true
|
|
|
|
|
, pim6dSupport ? true
|
|
|
|
|
, sharpdSupport ? true
|
|
|
|
|
, fabricdSupport ? true
|
|
|
|
|
, vrrpdSupport ? true
|
|
|
|
|
, pathdSupport ? true
|
|
|
|
|
, bfddSupport ? true
|
|
|
|
|
, pbrdSupport ? true
|
|
|
|
|
, staticdSupport ? true
|
|
|
|
|
|
|
|
|
|
# BGP options
|
|
|
|
|
, bgpAnnounce ? true
|
|
|
|
|
, bgpBmp ? true
|
|
|
|
|
, bgpVnc ? true
|
|
|
|
|
|
|
|
|
|
# OSPF options
|
|
|
|
|
, ospfApi ? true
|
2022-01-13 20:06:32 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
|
lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform))
|
|
|
|
|
"cannot enable SNMP support due to cross-compilation issues with net-snmp-config"
|
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "frr";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
version = "9.1";
|
2022-01-13 20:06:32 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "FRRouting";
|
|
|
|
|
repo = pname;
|
|
|
|
|
rev = "${pname}-${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
hash = "sha256-oDPr51vI+tlT1IiUPufmZh/UE0TNKWrn4RqpnGoGxNo=";
|
2022-01-13 20:06:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
|
autoreconfHook
|
|
|
|
|
bison
|
|
|
|
|
flex
|
|
|
|
|
perl
|
|
|
|
|
pkg-config
|
2022-05-18 14:49:53 +00:00
|
|
|
|
python3.pkgs.sphinx
|
2022-01-13 20:06:32 +00:00
|
|
|
|
texinfo
|
2023-10-09 19:29:22 +00:00
|
|
|
|
protobufc
|
2022-01-13 20:06:32 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
|
c-ares
|
|
|
|
|
json_c
|
|
|
|
|
libelf
|
|
|
|
|
libunwind
|
|
|
|
|
libyang
|
|
|
|
|
openssl
|
|
|
|
|
pam
|
|
|
|
|
pcre2
|
|
|
|
|
python3
|
|
|
|
|
readline
|
2022-06-16 17:23:12 +00:00
|
|
|
|
rtrlib
|
2023-10-09 19:29:22 +00:00
|
|
|
|
protobufc
|
2022-01-13 20:06:32 +00:00
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
|
libcap
|
2023-08-22 20:05:09 +00:00
|
|
|
|
] ++ lib.optionals snmpSupport [
|
|
|
|
|
net-snmp
|
2022-01-13 20:06:32 +00:00
|
|
|
|
];
|
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
|
# otherwise in cross-compilation: "configure: error: no working python version found"
|
|
|
|
|
depsBuildBuild = [
|
|
|
|
|
buildPackages.python3
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# cross-compiling: clippy is compiled with the build host toolchain, split it out to ease
|
|
|
|
|
# navigation in dependency hell
|
|
|
|
|
clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frrVersion = version; frrSource = src; };
|
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
|
configureFlags = [
|
2023-08-22 20:05:09 +00:00
|
|
|
|
"--disable-silent-rules"
|
2022-01-13 20:06:32 +00:00
|
|
|
|
"--disable-exampledir"
|
|
|
|
|
"--enable-configfile-mask=0640"
|
2022-05-18 14:49:53 +00:00
|
|
|
|
"--enable-group=frr"
|
2022-01-13 20:06:32 +00:00
|
|
|
|
"--enable-logfile-mask=0640"
|
2023-08-22 20:05:09 +00:00
|
|
|
|
"--enable-multipath=${toString numMultipath}"
|
2022-05-18 14:49:53 +00:00
|
|
|
|
"--enable-user=frr"
|
|
|
|
|
"--enable-vty-group=frrvty"
|
|
|
|
|
"--localstatedir=/run/frr"
|
|
|
|
|
"--sbindir=$(out)/libexec/frr"
|
|
|
|
|
"--sysconfdir=/etc/frr"
|
2023-08-22 20:05:09 +00:00
|
|
|
|
"--with-clippy=${clippy-helper}/bin/clippy"
|
|
|
|
|
# general options
|
|
|
|
|
(lib.strings.enableFeature snmpSupport "snmp")
|
|
|
|
|
(lib.strings.enableFeature rpkiSupport "rpki")
|
|
|
|
|
(lib.strings.enableFeature watchfrrSupport "watchfrr")
|
|
|
|
|
(lib.strings.enableFeature rtadvSupport "rtadv")
|
|
|
|
|
(lib.strings.enableFeature irdpSupport "irdp")
|
|
|
|
|
(lib.strings.enableFeature routeReplacementSupport "rr-semantics")
|
2023-10-09 19:29:22 +00:00
|
|
|
|
(lib.strings.enableFeature mgmtdSupport "mgmtd")
|
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
|
# routing protocols
|
|
|
|
|
(lib.strings.enableFeature bgpdSupport "bgpd")
|
|
|
|
|
(lib.strings.enableFeature ripdSupport "ripd")
|
|
|
|
|
(lib.strings.enableFeature ripngdSupport "ripngd")
|
|
|
|
|
(lib.strings.enableFeature ospfdSupport "ospfd")
|
|
|
|
|
(lib.strings.enableFeature ospf6dSupport "ospf6d")
|
|
|
|
|
(lib.strings.enableFeature ldpdSupport "ldpd")
|
|
|
|
|
(lib.strings.enableFeature nhrpdSupport "nhrpd")
|
|
|
|
|
(lib.strings.enableFeature eigrpdSupport "eigrpd")
|
|
|
|
|
(lib.strings.enableFeature babeldSupport "babeld")
|
|
|
|
|
(lib.strings.enableFeature isisdSupport "isisd")
|
|
|
|
|
(lib.strings.enableFeature pimdSupport "pimd")
|
|
|
|
|
(lib.strings.enableFeature pim6dSupport "pim6d")
|
|
|
|
|
(lib.strings.enableFeature sharpdSupport "sharpd")
|
|
|
|
|
(lib.strings.enableFeature fabricdSupport "fabricd")
|
|
|
|
|
(lib.strings.enableFeature vrrpdSupport "vrrpd")
|
|
|
|
|
(lib.strings.enableFeature pathdSupport "pathd")
|
|
|
|
|
(lib.strings.enableFeature bfddSupport "bfdd")
|
|
|
|
|
(lib.strings.enableFeature pbrdSupport "pbrd")
|
|
|
|
|
(lib.strings.enableFeature staticdSupport "staticd")
|
|
|
|
|
# BGP options
|
|
|
|
|
(lib.strings.enableFeature bgpAnnounce "bgp-announce")
|
|
|
|
|
(lib.strings.enableFeature bgpBmp "bgp-bmp")
|
|
|
|
|
(lib.strings.enableFeature bgpVnc "bgp-vnc")
|
|
|
|
|
# OSPF options
|
|
|
|
|
(lib.strings.enableFeature ospfApi "ospfapi")
|
|
|
|
|
# Cumulus options
|
|
|
|
|
(lib.strings.enableFeature cumulusSupport "cumulus")
|
|
|
|
|
# Datacenter options
|
|
|
|
|
(lib.strings.enableFeature datacenterSupport "datacenter")
|
2022-01-13 20:06:32 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-05-18 14:49:53 +00:00
|
|
|
|
substituteInPlace tools/frr-reload \
|
|
|
|
|
--replace /usr/lib/frr/ $out/libexec/frr/
|
2022-01-13 20:06:32 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
doCheck = true;
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
|
nativeCheckInputs = [
|
2022-01-13 20:06:32 +00:00
|
|
|
|
nettools
|
2022-05-18 14:49:53 +00:00
|
|
|
|
python3.pkgs.pytest
|
2022-01-13 20:06:32 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-05-18 14:49:53 +00:00
|
|
|
|
homepage = "https://frrouting.org/";
|
2022-01-13 20:06:32 +00:00
|
|
|
|
description = "FRR BGP/OSPF/ISIS/RIP/RIPNG routing daemon suite";
|
|
|
|
|
longDescription = ''
|
|
|
|
|
FRRouting (FRR) is a free and open source Internet routing protocol suite
|
|
|
|
|
for Linux and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM,
|
|
|
|
|
LDP, BFD, Babel, PBR, OpenFabric and VRRP, with alpha support for EIGRP
|
|
|
|
|
and NHRP.
|
|
|
|
|
|
|
|
|
|
FRR’s seamless integration with native Linux/Unix IP networking stacks
|
|
|
|
|
makes it a general purpose routing stack applicable to a wide variety of
|
|
|
|
|
use cases including connecting hosts/VMs/containers to the network,
|
|
|
|
|
advertising network services, LAN switching and routing, Internet access
|
|
|
|
|
routers, and Internet peering.
|
|
|
|
|
|
|
|
|
|
FRR has its roots in the Quagga project. In fact, it was started by many
|
|
|
|
|
long-time Quagga developers who combined their efforts to improve on
|
|
|
|
|
Quagga’s well-established foundation in order to create the best routing
|
|
|
|
|
protocol stack available. We invite you to participate in the FRRouting
|
|
|
|
|
community and help shape the future of networking.
|
|
|
|
|
|
|
|
|
|
Join the ranks of network architects using FRR for ISPs, SaaS
|
|
|
|
|
infrastructure, web 2.0 businesses, hyperscale services, and Fortune 500
|
|
|
|
|
private clouds.
|
|
|
|
|
'';
|
|
|
|
|
license = with licenses; [ gpl2Plus lgpl21Plus ];
|
2023-08-22 20:05:09 +00:00
|
|
|
|
maintainers = with maintainers; [ woffs thillux ];
|
2023-10-09 19:29:22 +00:00
|
|
|
|
# adapt to platforms stated in http://docs.frrouting.org/en/latest/overview.html#supported-platforms
|
|
|
|
|
platforms = (platforms.linux ++ platforms.freebsd ++ platforms.netbsd ++ platforms.openbsd);
|
2022-01-13 20:06:32 +00:00
|
|
|
|
};
|
2022-05-18 14:49:53 +00:00
|
|
|
|
|
|
|
|
|
passthru.tests = { inherit (nixosTests) frr; };
|
2022-01-13 20:06:32 +00:00
|
|
|
|
}
|