about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/frr/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-08-23 10:09:14 +0000
committerAlyssa Ross <hi@alyssa.is>2023-08-26 09:07:03 +0000
commit63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f (patch)
treed58934cb48f9c953b19a0d0d5cffc0d0c5561471 /nixpkgs/pkgs/servers/frr/default.nix
parentc4eef3dacb2a3d359561f30917d9e3cc4e041be9 (diff)
parent91a22f76cd1716f9d0149e8a5c68424bb691de15 (diff)
downloadnixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.gz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.bz2
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.lz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.xz
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.tar.zst
nixlib-63dabcc77ef9a56655e1ca2ab2e25e6163a72c1f.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/development/python-modules/django-mailman3/default.nix
Diffstat (limited to 'nixpkgs/pkgs/servers/frr/default.nix')
-rw-r--r--nixpkgs/pkgs/servers/frr/default.nix108
1 files changed, 103 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/servers/frr/default.nix b/nixpkgs/pkgs/servers/frr/default.nix
index f50e3c0b2a8c..87fd2064a563 100644
--- a/nixpkgs/pkgs/servers/frr/default.nix
+++ b/nixpkgs/pkgs/servers/frr/default.nix
@@ -9,6 +9,7 @@
 , perl
 , pkg-config
 , texinfo
+, buildPackages
 
 # runtime
 , c-ares
@@ -28,8 +29,58 @@
 # tests
 , nettools
 , nixosTests
+
+# 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
+
+# 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
 }:
 
+lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform))
+  "cannot enable SNMP support due to cross-compilation issues with net-snmp-config"
+
 stdenv.mkDerivation rec {
   pname = "frr";
   version = "8.5.2";
@@ -57,7 +108,6 @@ stdenv.mkDerivation rec {
     libelf
     libunwind
     libyang
-    net-snmp
     openssl
     pam
     pcre2
@@ -66,21 +116,69 @@ stdenv.mkDerivation rec {
     rtrlib
   ] ++ lib.optionals stdenv.isLinux [
     libcap
+  ] ++ lib.optionals snmpSupport [
+    net-snmp
   ];
 
+  # 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; };
+
   configureFlags = [
+    "--disable-silent-rules"
     "--disable-exampledir"
     "--enable-configfile-mask=0640"
     "--enable-group=frr"
     "--enable-logfile-mask=0640"
-    "--enable-multipath=64"
-    "--enable-snmp"
+    "--enable-multipath=${toString numMultipath}"
     "--enable-user=frr"
     "--enable-vty-group=frrvty"
     "--localstatedir=/run/frr"
     "--sbindir=$(out)/libexec/frr"
     "--sysconfdir=/etc/frr"
-    "--enable-rpki"
+    "--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")
+    # 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")
   ];
 
   postPatch = ''
@@ -123,7 +221,7 @@ stdenv.mkDerivation rec {
       private clouds.
     '';
     license = with licenses; [ gpl2Plus lgpl21Plus ];
-    maintainers = with maintainers; [ woffs ];
+    maintainers = with maintainers; [ woffs thillux ];
     platforms = platforms.unix;
   };