1 { config, lib, pkgs, ... }:
6 cfg = config.services.miredo;
7 pidFile = "/run/miredo.pid";
8 miredoConf = pkgs.writeText "miredo.conf" ''
9 InterfaceName ${cfg.interfaceName}
10 ServerAddress ${cfg.serverAddress}
11 ${optionalString (cfg.bindAddress != null) "BindAddress ${cfg.bindAddress}"}
12 ${optionalString (cfg.bindPort != null) "BindPort ${cfg.bindPort}"}
23 enable = mkEnableOption "the Miredo IPv6 tunneling service";
25 package = mkPackageOption pkgs "miredo" { };
27 serverAddress = mkOption {
28 default = "teredo.remlab.net";
31 The hostname or primary IPv4 address of the Teredo server.
32 This setting is required if Miredo runs as a Teredo client.
33 "teredo.remlab.net" is an experimental service for testing only.
34 Please use another server for production and/or large scale deployments.
38 interfaceName = mkOption {
42 Name of the network tunneling interface.
46 bindAddress = mkOption {
48 type = types.nullOr types.str;
50 Depending on the local firewall/NAT rules, you might need to force
51 Miredo to use a fixed UDP port and or IPv4 address.
57 type = types.nullOr types.str;
59 Depending on the local firewall/NAT rules, you might need to force
60 Miredo to use a fixed UDP port and or IPv4 address.
69 config = mkIf cfg.enable {
71 systemd.services.miredo = {
72 wantedBy = [ "multi-user.target" ];
73 after = [ "network.target" ];
74 description = "Teredo IPv6 Tunneling Daemon";
78 ExecStart = "${cfg.package}/bin/miredo -c ${miredoConf} -p ${pidFile} -f";
79 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";