1 { config, pkgs, lib, ... }:
3 cfg = config.services.gobgpd;
4 format = pkgs.formats.toml { };
5 confFile = format.generate "gobgpd.conf" cfg.settings;
7 options.services.gobgpd = {
8 enable = lib.mkEnableOption "GoBGP Routing Daemon";
10 settings = lib.mkOption {
14 GoBGP configuration. Refer to
15 <https://github.com/osrg/gobgp#documentation>
16 for details on supported values.
18 example = lib.literalExpression ''
23 router-id = "192.168.255.1";
29 neighbor-address = "10.0.255.1";
35 neighbor-address = "10.0.255.2";
45 config = lib.mkIf cfg.enable {
46 environment.systemPackages = [ pkgs.gobgpd ];
47 systemd.services.gobgpd = {
48 wantedBy = [ "multi-user.target" ];
49 after = [ "network.target" ];
50 description = "GoBGP Routing Daemon";
53 ExecStartPre = "${pkgs.gobgpd}/bin/gobgpd -f ${confFile} -d";
54 ExecStart = "${pkgs.gobgpd}/bin/gobgpd -f ${confFile} --sdnotify";
55 ExecReload = "${pkgs.gobgpd}/bin/gobgpd -r";
57 AmbientCapabilities = "cap_net_bind_service";