@@ -43,6 +43,14 @@ in
4343 '';
4444 };
4545
46+ ed25519PrivateKeyFile = mkOption {
47+ default = null;
48+ type = types.nullOr types.path;
49+ description = ''
50+ Path of the private ed25519 keyfile.
51+ '';
52+ };
53+
4654 debugLevel = mkOption {
4755 default = 0;
4856 type = types.addCheck types.int (l: l >= 0 && l <= 5);
@@ -70,6 +78,14 @@ in
7078 '';
7179 };
7280
81+ listenAddress = mkOption {
82+ default = null;
83+ type = types.nullOr types.str;
84+ description = ''
85+ The ip adress to bind to.
86+ '';
87+ };
88+
7389 package = mkOption {
7490 default = pkgs.tinc_pre;
7591 description = ''
@@ -99,6 +115,8 @@ in
99115 text = ''
100116 Name = ${if data.name == null then "$HOST" else data.name}
101117 DeviceType = ${data.interfaceType}
118+ ${optionalString (data.ed25519PrivateKeyFile != null) "Ed25519PrivateKeyFile = ${data.ed25519PrivateKeyFile}"}
119+ ${optionalString (data.listenAddress != null) "BindToAddress = ${data.listenAddress}"}
102120 Device = /dev/net/tun
103121 Interface = tinc.${network}
104122 ${data.extraConfig}
@@ -134,10 +152,10 @@ in
134152 # Determine how we should generate our keys
135153 if type tinc >/dev/null 2>&1; then
136154 # Tinc 1.1+ uses the tinc helper application for key generation
137−
155+ ${if data.ed25519PrivateKeyFile != null then " # Keyfile managed by nix" else ''
138156 # Prefer ED25519 keys (only in 1.1+)
139157 [ -f "/etc/tinc/${network}/ed25519_key.priv" ] || tinc -n ${network} generate-ed25519-keys
140−
158+ ''}
141159 # Otherwise use RSA keys
142160 [ -f "/etc/tinc/${network}/rsa_key.priv" ] || tinc -n ${network} generate-rsa-keys 4096
143161 else