diff options
author | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-05-21 03:24:20 +0300 |
---|---|---|
committer | Arseniy Seroka <jagajaga@users.noreply.github.com> | 2015-05-21 03:24:20 +0300 |
commit | a9171953c65ac3a6330435ee2d551d8859bbb08f (patch) | |
tree | 71db932145d320a361b74d26abeed57b7dbe6fc3 /nixos | |
parent | bfc1582b81937b24466a4e20d4dbbb1830c14108 (diff) | |
parent | 9d07c54fa11bc577f8fc946aef9be9d059d4f40a (diff) | |
download | nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar.gz nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar.bz2 nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar.lz nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar.xz nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.tar.zst nixpkgs-a9171953c65ac3a6330435ee2d551d8859bbb08f.zip |
Merge pull request #7860 from Lassulus/bird
nixos: add bird module
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/misc/ids.nix | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/networking/bird.nix | 76 |
3 files changed, 79 insertions, 0 deletions
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 0039ca74ba8..3f45f78a9d8 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -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 diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 043b0470edf..bef3f7f2fe7 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/services/networking/bird.nix b/nixos/modules/services/networking/bird.nix new file mode 100644 index 00000000000..2fa1d6af7d2 --- /dev/null +++ b/nixos/modules/services/networking/bird.nix @@ -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}"; + }; + }; + }; +} |