git.iko.soy/typeable/nixpkgs
on master help sign in
nixos: add bird module

patch bird to look in /var/run for birc.ctl

commit9d07c54fa11bc577f8fc946aef9be9d059d4f40a authorlassulus <lass@aidsballs.de> dateSat 16 May 2015, 23:22 (12 years ago) parent8f648b2
5 files changed+100
nixos/modules/misc/ids.nix+2 nixos/modules/module-list.nix+1 nixos/modules/services/networking/bird.nix+76 pkgs/servers/bird/default.nix+8 pkgs/servers/bird/dont-create-sysconfdir.patch+13
nixos/modules/misc/ids.nix+2
@@ -217,6 +217,7 @@
217217 lambdabot = 191;
218218 asterisk = 192;
219219 plex = 193;
220+ bird = 195;
220221
221222 # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
222223
@@ -412,6 +413,7 @@
412413 #asterisk = 192; # unused
413414 plex = 193;
414415 sabnzbd = 194;
416+ bird = 195;
415417
416418 # When adding a gid, make sure it doesn't match an existing
417419 # uid. Users and groups with the same name should have equal
nixos/modules/module-list.nix+1
@@ -252,6 +252,7 @@
252252 ./services/networking/atftpd.nix
253253 ./services/networking/avahi-daemon.nix
254254 ./services/networking/bind.nix
255+ ./services/networking/bird.nix
255256 ./services/networking/bitlbee.nix
256257 ./services/networking/btsync.nix
257258 ./services/networking/charybdis.nix
nixos/modules/services/networking/bird.nixnew file+76
@@ -0,0 +1,76 @@
1+{ config, lib, pkgs, ... }:
2+
3+let
4+ inherit (lib) mkEnableOption mkIf mkOption singleton types;
5+ inherit (pkgs) bird;
6+ cfg = config.services.bird;
7+
8+ configFile = pkgs.writeText "bird.conf" ''
9+ ${cfg.config}
10+ '';
11+in
12+
13+{
14+
15+ ###### interface
16+
17+ options = {
18+
19+ services.bird = {
20+
21+ enable = mkEnableOption "BIRD Internet Routing Daemon";
22+
23+ config = mkOption {
24+ type = types.string;
25+ description = ''
26+ BIRD Internet Routing Daemon configuration file.
27+ http://bird.network.cz/?get_doc&f=bird-3.html
28+ '';
29+ };
30+
31+ user = mkOption {
32+ type = types.string;
33+ default = "ircd";
34+ description = ''
35+ BIRD Internet Routing Daemon user.
36+ '';
37+ };
38+
39+ group = mkOption {
40+ type = types.string;
41+ default = "ircd";
42+ description = ''
43+ BIRD Internet Routing Daemon group.
44+ '';
45+ };
46+
47+ };
48+
49+ };
50+
51+
52+ ###### implementation
53+
54+ config = mkIf cfg.enable {
55+
56+ users.extraUsers = singleton {
57+ name = cfg.user;
58+ description = "BIRD Internet Routing Daemon user";
59+ uid = config.ids.uids.bird;
60+ group = cfg.group;
61+ };
62+
63+ users.extraGroups = singleton {
64+ name = cfg.group;
65+ gid = config.ids.gids.bird;
66+ };
67+
68+ systemd.services.bird = {
69+ description = "BIRD Internet Routing Daemon";
70+ wantedBy = [ "multi-user.target" ];
71+ serviceConfig = {
72+ ExecStart = "${bird}/bin/bird -d -c ${configFile} -s /var/run/bird.ctl -u ${cfg.user} -g ${cfg.group}";
73+ };
74+ };
75+ };
76+}
pkgs/servers/bird/default.nix+8
@@ -10,6 +10,14 @@ stdenv.mkDerivation rec {
1010
1111 buildInputs = [ flex bison readline ];
1212
13+ patches = [
14+ ./dont-create-sysconfdir.patch
15+ ];
16+
17+ configureFlags = [
18+ "--localstatedir /var"
19+ ];
20+
1321 meta = {
1422 description = "BIRD Internet Routing Daemon";
1523 homepage = http://bird.network.cz;
pkgs/servers/bird/dont-create-sysconfdir.patchnew file+13
@@ -0,0 +1,13 @@
1+diff --git a/tools/Makefile.in b/tools/Makefile.in
2+index 062ba91..4fd7453 100644
3+--- a/tools/Makefile.in
4++++ b/tools/Makefile.in
5+@@ -68,7 +68,7 @@ tags:
6+ cd $(srcdir) ; etags -lc `find $(static-dirs) $(addprefix $(objdir)/,$(dynamic-dirs)) $(client-dirs) -name *.[chY]`
7+
8+ install: all
9+- $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir) $(DESTDIR)/@runtimedir@
10++ $(INSTALL) -d $(DESTDIR)/$(sbindir) $(DESTDIR)/$(sysconfdir)
11+ $(INSTALL_PROGRAM) $(exedir)/bird $(DESTDIR)/$(sbindir)/bird@SUFFIX@
12+ $(INSTALL_PROGRAM) $(exedir)/birdcl $(DESTDIR)/$(sbindir)/birdcl@SUFFIX@
13+ if test -n "@CLIENT@" ; then \