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 (lib.mdDoc "the Miredo IPv6 tunneling service");
27 default = pkgs.miredo;
28 defaultText = literalExpression "pkgs.miredo";
29 description = lib.mdDoc ''
30 The package to use for the miredo daemon's binary.
34 serverAddress = mkOption {
35 default = "teredo.remlab.net";
37 description = lib.mdDoc ''
38 The hostname or primary IPv4 address of the Teredo server.
39 This setting is required if Miredo runs as a Teredo client.
40 "teredo.remlab.net" is an experimental service for testing only.
41 Please use another server for production and/or large scale deployments.
45 interfaceName = mkOption {
48 description = lib.mdDoc ''
49 Name of the network tunneling interface.
53 bindAddress = mkOption {
55 type = types.nullOr types.str;
56 description = lib.mdDoc ''
57 Depending on the local firewall/NAT rules, you might need to force
58 Miredo to use a fixed UDP port and or IPv4 address.
64 type = types.nullOr types.str;
65 description = lib.mdDoc ''
66 Depending on the local firewall/NAT rules, you might need to force
67 Miredo to use a fixed UDP port and or IPv4 address.
76 config = mkIf cfg.enable {
78 systemd.services.miredo = {
79 wantedBy = [ "multi-user.target" ];
80 after = [ "network.target" ];
81 description = "Teredo IPv6 Tunneling Daemon";
85 ExecStart = "${cfg.package}/bin/miredo -c ${miredoConf} -p ${pidFile} -f";
86 ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";