Merge pull request #28562 from oxij/nixos/i2pd
nixos: i2pd: bits and pieces
This commit is contained in:
commit
227697bc67
@ -17,8 +17,9 @@ with lib;
|
|||||||
(mkRenamedOptionModule [ "services" "elasticsearch" "host" ] [ "services" "elasticsearch" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "elasticsearch" "host" ] [ "services" "elasticsearch" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "graphite" "api" "host" ] [ "services" "graphite" "api" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "graphite" "api" "host" ] [ "services" "graphite" "api" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "graphite" "web" "host" ] [ "services" "graphite" "web" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "graphite" "web" "host" ] [ "services" "graphite" "web" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "logstash" "address" ] [ "services" "logstash" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "i2pd" "extIp" ] [ "services" "i2pd" "address" ])
|
||||||
(mkRenamedOptionModule [ "services" "kibana" "host" ] [ "services" "kibana" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "kibana" "host" ] [ "services" "kibana" "listenAddress" ])
|
||||||
|
(mkRenamedOptionModule [ "services" "logstash" "address" ] [ "services" "logstash" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "mpd" "network" "host" ] [ "services" "mpd" "network" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "mpd" "network" "host" ] [ "services" "mpd" "network" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "neo4j" "host" ] [ "services" "neo4j" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "neo4j" "host" ] [ "services" "neo4j" "listenAddress" ])
|
||||||
(mkRenamedOptionModule [ "services" "shout" "host" ] [ "services" "shout" "listenAddress" ])
|
(mkRenamedOptionModule [ "services" "shout" "host" ] [ "services" "shout" "listenAddress" ])
|
||||||
|
@ -28,15 +28,15 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
mkKeyedEndpointOpt = name: addr: port: keyFile:
|
mkKeyedEndpointOpt = name: addr: port: keyFile:
|
||||||
(mkEndpointOpt name addr port) // {
|
(mkEndpointOpt name addr port) // {
|
||||||
keys = mkOption {
|
keys = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
File to persist ${lib.toUpper name} keys.
|
File to persist ${lib.toUpper name} keys.
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
commonTunOpts = let
|
commonTunOpts = let
|
||||||
i2cpOpts = {
|
i2cpOpts = {
|
||||||
@ -59,7 +59,7 @@ let
|
|||||||
description = "Number of ElGamal/AES tags to send.";
|
description = "Number of ElGamal/AES tags to send.";
|
||||||
default = 40;
|
default = 40;
|
||||||
};
|
};
|
||||||
destination = mkOption {
|
destination = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Remote endpoint, I2P hostname or b32.i2p address.";
|
description = "Remote endpoint, I2P hostname or b32.i2p address.";
|
||||||
};
|
};
|
||||||
@ -70,88 +70,91 @@ let
|
|||||||
};
|
};
|
||||||
} // mkEndpointOpt name "127.0.0.1" 0;
|
} // mkEndpointOpt name "127.0.0.1" 0;
|
||||||
|
|
||||||
i2pdConf = pkgs.writeText "i2pd.conf"
|
i2pdConf = pkgs.writeText "i2pd.conf" ''
|
||||||
''
|
# DO NOT EDIT -- this file has been generated automatically.
|
||||||
ipv4 = ${boolToString cfg.enableIPv4}
|
loglevel = ${cfg.logLevel}
|
||||||
ipv6 = ${boolToString cfg.enableIPv6}
|
|
||||||
notransit = ${boolToString cfg.notransit}
|
|
||||||
floodfill = ${boolToString cfg.floodfill}
|
|
||||||
netid = ${toString cfg.netid}
|
|
||||||
${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" }
|
|
||||||
${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
|
|
||||||
|
|
||||||
[limits]
|
ipv4 = ${boolToString cfg.enableIPv4}
|
||||||
transittunnels = ${toString cfg.limits.transittunnels}
|
ipv6 = ${boolToString cfg.enableIPv6}
|
||||||
|
notransit = ${boolToString cfg.notransit}
|
||||||
|
floodfill = ${boolToString cfg.floodfill}
|
||||||
|
netid = ${toString cfg.netid}
|
||||||
|
${if isNull cfg.bandwidth then "" else "bandwidth = ${toString cfg.bandwidth}" }
|
||||||
|
${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
|
||||||
|
|
||||||
[upnp]
|
[limits]
|
||||||
enabled = ${boolToString cfg.upnp.enable}
|
transittunnels = ${toString cfg.limits.transittunnels}
|
||||||
name = ${cfg.upnp.name}
|
|
||||||
|
|
||||||
[precomputation]
|
[upnp]
|
||||||
elgamal = ${boolToString cfg.precomputation.elgamal}
|
enabled = ${boolToString cfg.upnp.enable}
|
||||||
|
name = ${cfg.upnp.name}
|
||||||
|
|
||||||
[reseed]
|
[precomputation]
|
||||||
verify = ${boolToString cfg.reseed.verify}
|
elgamal = ${boolToString cfg.precomputation.elgamal}
|
||||||
file = ${cfg.reseed.file}
|
|
||||||
urls = ${builtins.concatStringsSep "," cfg.reseed.urls}
|
|
||||||
|
|
||||||
[addressbook]
|
[reseed]
|
||||||
defaulturl = ${cfg.addressbook.defaulturl}
|
verify = ${boolToString cfg.reseed.verify}
|
||||||
subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions}
|
file = ${cfg.reseed.file}
|
||||||
${flip concatMapStrings
|
urls = ${builtins.concatStringsSep "," cfg.reseed.urls}
|
||||||
|
|
||||||
|
[addressbook]
|
||||||
|
defaulturl = ${cfg.addressbook.defaulturl}
|
||||||
|
subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions}
|
||||||
|
|
||||||
|
${flip concatMapStrings
|
||||||
(collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
|
(collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
|
||||||
(proto: let portStr = toString proto.port; in
|
(proto: let portStr = toString proto.port; in ''
|
||||||
''
|
[${proto.name}]
|
||||||
[${proto.name}]
|
enabled = ${boolToString proto.enable}
|
||||||
enabled = ${boolToString proto.enable}
|
address = ${proto.address}
|
||||||
address = ${proto.address}
|
port = ${toString proto.port}
|
||||||
port = ${toString proto.port}
|
${if proto ? keys then "keys = ${proto.keys}" else ""}
|
||||||
${if proto ? keys then "keys = ${proto.keys}" else ""}
|
${if proto ? auth then "auth = ${boolToString proto.auth}" else ""}
|
||||||
${if proto ? auth then "auth = ${boolToString proto.auth}" else ""}
|
${if proto ? user then "user = ${proto.user}" else ""}
|
||||||
${if proto ? user then "user = ${proto.user}" else ""}
|
${if proto ? pass then "pass = ${proto.pass}" else ""}
|
||||||
${if proto ? pass then "pass = ${proto.pass}" else ""}
|
${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
|
||||||
${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""}
|
${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""}
|
||||||
${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""}
|
'')
|
||||||
'')
|
}
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" ''
|
i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" ''
|
||||||
${flip concatMapStrings
|
# DO NOT EDIT -- this file has been generated automatically.
|
||||||
(collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
|
${flip concatMapStrings
|
||||||
(tun: let portStr = toString tun.port; in ''
|
(collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
|
||||||
[${tun.name}]
|
(tun: let portStr = toString tun.port; in ''
|
||||||
type = client
|
[${tun.name}]
|
||||||
destination = ${tun.destination}
|
type = client
|
||||||
keys = ${tun.keys}
|
destination = ${tun.destination}
|
||||||
address = ${tun.address}
|
keys = ${tun.keys}
|
||||||
port = ${toString tun.port}
|
address = ${tun.address}
|
||||||
inbound.length = ${toString tun.inbound.length}
|
port = ${toString tun.port}
|
||||||
outbound.length = ${toString tun.outbound.length}
|
inbound.length = ${toString tun.inbound.length}
|
||||||
inbound.quantity = ${toString tun.inbound.quantity}
|
outbound.length = ${toString tun.outbound.length}
|
||||||
outbound.quantity = ${toString tun.outbound.quantity}
|
inbound.quantity = ${toString tun.inbound.quantity}
|
||||||
crypto.tagsToSend = ${toString tun.crypto.tagsToSend}
|
outbound.quantity = ${toString tun.outbound.quantity}
|
||||||
'')
|
crypto.tagsToSend = ${toString tun.crypto.tagsToSend}
|
||||||
}
|
'')
|
||||||
${flip concatMapStrings
|
}
|
||||||
(collect (tun: tun ? port && tun ? host) cfg.inTunnels)
|
${flip concatMapStrings
|
||||||
(tun: let portStr = toString tun.port; in ''
|
(collect (tun: tun ? port && tun ? host) cfg.inTunnels)
|
||||||
[${tun.name}]
|
(tun: let portStr = toString tun.port; in ''
|
||||||
type = server
|
[${tun.name}]
|
||||||
destination = ${tun.destination}
|
type = server
|
||||||
keys = ${tun.keys}
|
destination = ${tun.destination}
|
||||||
host = ${tun.address}
|
keys = ${tun.keys}
|
||||||
port = ${tun.port}
|
host = ${tun.address}
|
||||||
inport = ${tun.inPort}
|
port = ${tun.port}
|
||||||
accesslist = ${builtins.concatStringsSep "," tun.accessList}
|
inport = ${tun.inPort}
|
||||||
'')
|
accesslist = ${builtins.concatStringsSep "," tun.accessList}
|
||||||
}
|
'')
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
i2pdSh = pkgs.writeScriptBin "i2pd" ''
|
i2pdSh = pkgs.writeScriptBin "i2pd" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
${pkgs.i2pd}/bin/i2pd \
|
exec ${pkgs.i2pd}/bin/i2pd \
|
||||||
${if isNull cfg.extIp then "" else "--host="+cfg.extIp} \
|
${if isNull cfg.address then "" else "--host="+cfg.address} \
|
||||||
--conf=${i2pdConf} \
|
--conf=${i2pdConf} \
|
||||||
--tunconf=${i2pdTunnelConf}
|
--tunconf=${i2pdTunnelConf}
|
||||||
'';
|
'';
|
||||||
@ -176,11 +179,23 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extIp = mkOption {
|
logLevel = mkOption {
|
||||||
|
type = types.enum ["debug" "info" "warn" "error"];
|
||||||
|
default = "error";
|
||||||
|
description = ''
|
||||||
|
The log level. <command>i2pd</command> defaults to "info"
|
||||||
|
but that generates copious amounts of log messages.
|
||||||
|
|
||||||
|
We default to "error" which is similar to the default log
|
||||||
|
level of <command>tor</command>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
address = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Your external IP.
|
Your external IP or hostname.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -213,7 +228,7 @@ in
|
|||||||
default = null;
|
default = null;
|
||||||
description = ''
|
description = ''
|
||||||
Set a router bandwidth limit integer in KBps.
|
Set a router bandwidth limit integer in KBps.
|
||||||
If not set, i2pd defaults to 32KBps.
|
If not set, <command>i2pd</command> defaults to 32KBps.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -261,9 +276,14 @@ in
|
|||||||
|
|
||||||
precomputation.elgamal = mkOption {
|
precomputation.elgamal = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Use ElGamal precomputated tables.
|
Whenever to use precomputated tables for ElGamal.
|
||||||
|
<command>i2pd</command> defaults to <literal>false</literal>
|
||||||
|
to save 64M of memory (and looses some performance).
|
||||||
|
|
||||||
|
We default to <literal>true</literal> as that is what most
|
||||||
|
users want anyway.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -353,7 +373,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
proto.httpProxy = mkKeyedEndpointOpt "httpproxy" "127.0.0.1" 4446 "";
|
proto.httpProxy = mkKeyedEndpointOpt "httpproxy" "127.0.0.1" 4444 "";
|
||||||
proto.socksProxy = (mkKeyedEndpointOpt "socksproxy" "127.0.0.1" 4447 "")
|
proto.socksProxy = (mkKeyedEndpointOpt "socksproxy" "127.0.0.1" 4447 "")
|
||||||
// {
|
// {
|
||||||
outproxy = mkOption {
|
outproxy = mkOption {
|
||||||
|
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
|
|||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
homepage = https://i2pd.website;
|
homepage = https://i2pd.website;
|
||||||
description = "Minimal I2P router written in C++";
|
description = "Minimal I2P router written in C++";
|
||||||
license = licenses.gpl2;
|
license = licenses.bsd3;
|
||||||
maintainers = with maintainers; [ edwtjo ];
|
maintainers = with maintainers; [ edwtjo ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user