It’s almost shameful to admit that I don’t know more about my desktop operating than to build a package from source. Anyways, based off the old quagga code that was removed not too long ago I’m now trying to build FRRouting instead.
The nature of NixOS leans itself very well to being a BGP router, considering how many GiB/s a decent CPU can forward these days.
Anyhow, I’ve got the only new dependencies that weren’t packaged packaged (rtrlib, libyang) on my nixpkgs fork.
So when building FRR I’m currently failing like this:
checking for LIBYANG (libyang >= 2.0.0)... no
configure: error: libyang (>= 2.0.0) was not found on your system.
Which means i packaged either libyang wrong, am providing the wrong paths to libyang or the frr package.
I would really appreciate if someone could take a look at this and hint me in the right direction, I was looking at providing additional paths for autotools but I’m lost, I’ve only ever built C++ projects with cmake before so I’m probably missing something VERY obvious
I also tried to package FRR recently and ran into the same issue. You can find my attempt here. It is not tested thoroughly, but the build and NixOS module are functioning.
The problem with your build is your libyang package. It is missing a pkg-confignativeBuildInputs entry. pkg-config is not required to build libyang, but without the pkg-config binary it will not create the libyang.pc file, which FRR uses to detect the library.
The next issue you will probably run into is the following error:
configure: error: libyang needs to be compiled with ENABLE_LYD_PRIV=ON. Instructions for...
This error and the mentioned fix are completely wrong and misleading. libyang v2 removed the ENABLE_LYD_PRIV build flag and so there is no point in setting it. The actual error is a missing library during the configure phase. Linking libyang requires the pcre2 library, which is not correctly specified in the libyang.pc file (I’m not to familiar with pkg-config. The file specifies libpcre2-8 as a private dependency, but this doesn’t seem to work in nixpkgs). Adding pcre2 to the FRR buildInputs fixes this issue.
I hope this helps you in your attempt to add FRR to NixOS.
Thanks for your tips and the code for your FRR build, while untested it looks great! (Reading Nix is a lot easier than writing it, hehe) I’m gonna have to get used to flakes and do some testing of my own with your build and module. I’m slightly more familiar with FRR than with Nix so I guess I could set some tests up.
I think we could use vtysh --dry-run to check the config is valid before allowing to build the system too, thoughts?