Merge pull request #28562 from oxij/nixos/i2pd

nixos: i2pd: bits and pieces
This commit is contained in:
Joachim F 2017-08-26 10:07:35 +00:00 committed by GitHub
commit 227697bc67
3 changed files with 107 additions and 86 deletions

View File

@ -17,8 +17,9 @@ with lib;
(mkRenamedOptionModule [ "services" "elasticsearch" "host" ] [ "services" "elasticsearch" "listenAddress" ])
(mkRenamedOptionModule [ "services" "graphite" "api" "host" ] [ "services" "graphite" "api" "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" "logstash" "address" ] [ "services" "logstash" "listenAddress" ])
(mkRenamedOptionModule [ "services" "mpd" "network" "host" ] [ "services" "mpd" "network" "listenAddress" ])
(mkRenamedOptionModule [ "services" "neo4j" "host" ] [ "services" "neo4j" "listenAddress" ])
(mkRenamedOptionModule [ "services" "shout" "host" ] [ "services" "shout" "listenAddress" ])

View File

@ -70,8 +70,10 @@ let
};
} // 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.
loglevel = ${cfg.logLevel}
ipv4 = ${boolToString cfg.enableIPv4}
ipv6 = ${boolToString cfg.enableIPv6}
notransit = ${boolToString cfg.notransit}
@ -98,10 +100,10 @@ let
[addressbook]
defaulturl = ${cfg.addressbook.defaulturl}
subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions}
${flip concatMapStrings
(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}]
enabled = ${boolToString proto.enable}
address = ${proto.address}
@ -117,6 +119,7 @@ let
'';
i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" ''
# DO NOT EDIT -- this file has been generated automatically.
${flip concatMapStrings
(collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
(tun: let portStr = toString tun.port; in ''
@ -150,8 +153,8 @@ let
i2pdSh = pkgs.writeScriptBin "i2pd" ''
#!/bin/sh
${pkgs.i2pd}/bin/i2pd \
${if isNull cfg.extIp then "" else "--host="+cfg.extIp} \
exec ${pkgs.i2pd}/bin/i2pd \
${if isNull cfg.address then "" else "--host="+cfg.address} \
--conf=${i2pdConf} \
--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;
default = null;
description = ''
Your external IP.
Your external IP or hostname.
'';
};
@ -213,7 +228,7 @@ in
default = null;
description = ''
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 {
type = types.bool;
default = false;
default = true;
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 "")
// {
outproxy = mkOption {

View File

@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
homepage = https://i2pd.website;
description = "Minimal I2P router written in C++";
license = licenses.gpl2;
license = licenses.bsd3;
maintainers = with maintainers; [ edwtjo ];
platforms = platforms.linux;
};