@@ -0,0 +1,93 @@
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 "Whether miredo should be run on startup.";
26+ type = types.package;
27+ default = pkgs.miredo;
28+ defaultText = "pkgs.miredo";
30+ The package to use for the miredo daemon's binary.
34+ serverAddress = mkOption {
35+ default = "teredo.remlab.net";
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 {
49+ Name of the network tunneling interface.
53+ bindAddress = mkOption {
55+ type = types.nullOr types.str;
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.
62+ bindPort = mkOption {
64+ type = types.nullOr types.str;
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.
74+ ###### implementation
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+ ExecStartPre = "${cfg.package}/bin/miredo-checkconf -f ${miredoConf}";
86+ ExecStart = "${cfg.package}/bin/miredo -c ${miredoConf} -p ${pidFile} -f";
87+ ExecReload = "/bin/kill -HUP $MAINPID";