8 cfg = config.services.birdwatcher;
12 services.birdwatcher = {
13 package = lib.mkPackageOption pkgs "birdwatcher" { };
14 enable = lib.mkEnableOption "Birdwatcher";
15 flags = lib.mkOption {
17 type = lib.types.listOf lib.types.str;
19 "-worker-pool-size 16"
23 Flags to append to the program call
27 settings = lib.mkOption {
28 type = lib.types.lines;
31 birdwatcher configuration, for configuration options see the example on [github](https://github.com/alice-lg/birdwatcher/blob/master/etc/birdwatcher/birdwatcher.conf)
33 example = lib.literalExpression ''
36 allow_uncached = false
37 modules_enabled = ["status",
44 "routes_table_filtered",
49 "routes_pipe_filtered_count",
50 "routes_pipe_filtered"
54 reconfig_timestamp_source = "bird"
55 reconfig_timestamp_match = "# created: (.*)"
60 listen = "0.0.0.0:29184"
61 config = "/etc/bird/bird2.conf"
62 birdc = "''${pkgs.bird}/bin/birdc"
63 ttl = 5 # time to live (in minutes) for caching of cli output
69 use_redis = false # if not using redis cache, activate housekeeping to save memory!
73 force_release_memory = true
81 flagsStr = lib.escapeShellArgs cfg.flags;
84 environment.etc."birdwatcher/birdwatcher.conf".source = pkgs.writeTextFile {
85 name = "birdwatcher.conf";
90 wants = [ "network.target" ];
91 after = [ "network.target" ];
92 wantedBy = [ "multi-user.target" ];
93 description = "Birdwatcher";
96 Restart = "on-failure";
98 ExecStart = "${cfg.package}/bin/birdwatcher";
99 StateDirectoryMode = "0700";
101 NoNewPrivileges = true;
102 ProtectSystem = "strict";
104 PrivateDevices = true;
105 ProtectHostname = true;
107 ProtectKernelTunables = true;
108 ProtectKernelModules = true;
109 ProtectKernelLogs = true;
110 ProtectControlGroups = true;
111 RestrictAddressFamilies = [ "AF_UNIX AF_INET AF_INET6" ];
112 LockPersonality = true;
113 MemoryDenyWriteExecute = true;
114 RestrictRealtime = true;
115 RestrictSUIDSGID = true;
116 PrivateMounts = true;
117 SystemCallArchitectures = "native";
118 SystemCallFilter = "~@clock @privileged @cpu-emulation @debug @keyring @module @mount @obsolete @raw-io @reboot @setuid @swap";
119 BindReadOnlyPaths = [
121 "-/etc/nsswitch.conf"
123 "-/etc/static/ssl/certs"