Newshot

Turning BIRD configuration language into NixOS modules through lexer and parser specifications

Original text(via Lobsters)

Back in 2025 I gave a talk on using NixOS machines as boarder routers ( Internet scale routing with NixOS :: NixCon 2025 :: pretalx ) and at NixCon 26 there’s has been a few other attempts to use NixOS in similar fields as well (all very nicely done btw!).

Since I very heavily use BIRD (https://bird.nic.cz), but manually typing out the options I need is very cumbersome (in the sense of using Nix as a templating engine). I used to do this and the file got sooo big I don’t even want to look at it

Over the weekend I was thinking since BIRD (potentially other routing daemons, web servers, etc) use parser/lexer gen to programmatically annotate config production rules, why can’t we just go through those rules and generate a grammar production index, then with some annotations, converting ugly type names to pretty NixOS module type declarations with 100% accuracy?

Options search: NixOS Router - Simple and fast static-page NixOS option and packages search

Examples: router/examples/bird at master · stepbrobd/router · GitHub

My usage: Code search results · GitHub

LLM disclosure: this is slop coded for fun but I think should be prod ready for those who like to yolo

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Lobsters
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗