nixos: add bird module

patch bird to look in /var/run for birc.ctl
This commit is contained in:
lassulus
2015-05-16 23:22:35 +02:00
parent 8f648b2d14
commit 9d07c54fa1
5 changed files with 100 additions and 0 deletions

View File

@@ -217,6 +217,7 @@
lambdabot = 191;
asterisk = 192;
plex = 193;
bird = 195;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@@ -412,6 +413,7 @@
#asterisk = 192; # unused
plex = 193;
sabnzbd = 194;
bird = 195;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal

View File

@@ -252,6 +252,7 @@
./services/networking/atftpd.nix
./services/networking/avahi-daemon.nix
./services/networking/bind.nix
./services/networking/bird.nix
./services/networking/bitlbee.nix
./services/networking/btsync.nix
./services/networking/charybdis.nix

View File

@@ -0,0 +1,76 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption singleton types;
inherit (pkgs) bird;
cfg = config.services.bird;
configFile = pkgs.writeText "bird.conf" ''
${cfg.config}
'';
in
{
###### interface
options = {
services.bird = {
enable = mkEnableOption "BIRD Internet Routing Daemon";
config = mkOption {
type = types.string;
description = ''
BIRD Internet Routing Daemon configuration file.
http://bird.network.cz/?get_doc&f=bird-3.html
'';
};
user = mkOption {
type = types.string;
default = "ircd";
description = ''
BIRD Internet Routing Daemon user.
'';
};
group = mkOption {
type = types.string;
default = "ircd";
description = ''
BIRD Internet Routing Daemon group.
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
users.extraUsers = singleton {
name = cfg.user;
description = "BIRD Internet Routing Daemon user";
uid = config.ids.uids.bird;
group = cfg.group;
};
users.extraGroups = singleton {
name = cfg.group;
gid = config.ids.gids.bird;
};
systemd.services.bird = {
description = "BIRD Internet Routing Daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${bird}/bin/bird -d -c ${configFile} -s /var/run/bird.ctl -u ${cfg.user} -g ${cfg.group}";
};
};
};
}