Merge pull request #211 from offlinehacker/iodined

Add iodined, ip over dns daemon
This commit is contained in:
Peter Simons 2013-08-05 00:50:47 -07:00
commit 7761b20411
3 changed files with 92 additions and 2 deletions

View File

@ -77,8 +77,9 @@ in
nginx = 60;
chrony = 61;
smtpd = 63;
smtpq = 64;
smtpq = 64;
supybot = 65;
iodined = 66;
# When adding a uid, make sure it doesn't match an existing gid.
@ -139,8 +140,9 @@ in
nginx = 60;
systemd-journal = 62;
smtpd = 63;
smtpq = 64;
smtpq = 64;
supybot = 65;
iodined = 66;
# When adding a gid, make sure it doesn't match an existing uid.

View File

@ -154,6 +154,7 @@
./services/networking/gvpe.nix
./services/networking/hostapd.nix
./services/networking/ifplugd.nix
./services/networking/iodined.nix
./services/networking/ircd-hybrid/default.nix
./services/networking/minidlna.nix
./services/networking/nat.nix

View File

@ -0,0 +1,87 @@
# NixOS module for iodine, ip over dns daemon
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.services.iodined;
iodinedUser = "iodined";
in
{
### configuration
options = {
services.iodined = {
enable = mkOption {
type = types.uniq types.bool;
default = false;
description = "Enable iodine, ip over dns daemon";
};
client = mkOption {
type = types.uniq types.bool;
default = false;
description = "Start iodine in client mode";
};
ip = mkOption {
type = types.uniq types.string;
default = "";
description = "Assigned ip address or ip range";
example = "172.16.10.1/24";
};
domain = mkOption {
type = types.uniq types.string;
default = "";
description = "Domain or subdomain of which nameservers point to us";
example = "tunnel.mydomain.com";
};
extraConfig = mkOption {
type = types.uniq types.string;
default = "";
description = "Additional command line parameters";
example = "-P mysecurepassword -l 192.168.1.10 -p 23";
};
};
};
### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.iodine ];
boot.kernelModules = [ "tun" ];
systemd.services.iodined = {
description = "iodine, ip over dns daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.iodine}/sbin/iodined -f -u ${iodinedUser} ${cfg.extraConfig} ${cfg.ip} ${cfg.domain}";
};
users.extraUsers = singleton {
name = iodinedUser;
uid = config.ids.uids.iodined;
description = "Iodine daemon user";
};
users.extraGroups.iodined.gid = config.ids.gids.iodined;
assertions = [{ assertion = if !cfg.client then cfg.ip != "" else true;
message = "cannot start iodined without ip set";}
{ assertion = cfg.domain != "";
message = "cannot start iodined without domain name set";}];
};
}