17 cfg = config.services.bird2;
20 "CAP_NET_BIND_SERVICE"
28 enable = mkEnableOption "BIRD Internet Routing Daemon";
32 BIRD Internet Routing Daemon configuration file.
33 <http://bird.network.cz/>
36 autoReload = mkOption {
40 Whether bird2 should be automatically reloaded when the configuration changes.
43 checkConfig = mkOption {
47 Whether the config should be checked at build time.
48 When the config can't be checked during build time, for example when it includes
49 other files, either disable this option or use `preCheckConfig` to create
50 the included files before checking.
53 preCheckConfig = mkOption {
57 echo "cost 100;" > include.conf
60 Commands to execute before the config file check. The file to be checked will be
61 available as `bird2.conf` in the current directory.
63 Files created with this option will not be available at service runtime, only during
71 (lib.mkRemovedOptionModule [ "services" "bird" ] "Use services.bird2 instead")
72 (lib.mkRemovedOptionModule [ "services" "bird6" ] "Use services.bird2 instead")
76 config = mkIf cfg.enable {
77 environment.systemPackages = [ pkgs.bird ];
79 environment.etc."bird/bird2.conf".source = pkgs.writeTextFile {
82 checkPhase = optionalString cfg.checkConfig ''
85 ${pkgs.buildPackages.bird}/bin/bird -d -p -c bird2.conf
89 systemd.services.bird2 = {
90 description = "BIRD Internet Routing Daemon";
91 wantedBy = [ "multi-user.target" ];
92 reloadTriggers = lib.optional cfg.autoReload config.environment.etc."bird/bird2.conf".source;
95 Restart = "on-failure";
98 ExecStart = "${pkgs.bird}/bin/bird -c /etc/bird/bird2.conf";
99 ExecReload = "${pkgs.bird}/bin/birdc configure";
100 ExecStop = "${pkgs.bird}/bin/birdc down";
101 RuntimeDirectory = "bird";
102 CapabilityBoundingSet = caps;
103 AmbientCapabilities = caps;
104 ProtectSystem = "full";
106 ProtectKernelTunables = true;
107 ProtectControlGroups = true;
109 PrivateDevices = true;
110 SystemCallFilter = "~@cpu-emulation @debug @keyring @module @mount @obsolete @raw-io";
111 MemoryDenyWriteExecute = "yes";
116 description = "BIRD Internet Routing Daemon user";