From cd6df6bbf7fe673fecb2ba43e3c14a4195733945 Mon Sep 17 00:00:00 2001 From: SLNOS Date: Sat, 1 Jul 2017 00:00:00 +0000 Subject: [PATCH 1/8] i2pd: fix meta.license --- pkgs/tools/networking/i2pd/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/networking/i2pd/default.nix b/pkgs/tools/networking/i2pd/default.nix index 8d2ac5ce9d73..ef2bc0c4828d 100644 --- a/pkgs/tools/networking/i2pd/default.nix +++ b/pkgs/tools/networking/i2pd/default.nix @@ -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; }; From c21d434d1b74523588fbd50080ec1cd59243599a Mon Sep 17 00:00:00 2001 From: SLNOS Date: Wed, 1 Mar 2017 00:00:00 +0000 Subject: [PATCH 2/8] nixos: i2pd: change httpproxy port to its default value --- nixos/modules/services/networking/i2pd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 7622f030f832..e16ef3beae5c 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -353,7 +353,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 { From b42a107bc60d072daedd5bed7106e62990543740 Mon Sep 17 00:00:00 2001 From: SLNOS Date: Wed, 1 Mar 2017 00:00:00 +0000 Subject: [PATCH 3/8] nixos: i2pd: rename extIp -> address to harmonize with tor --- nixos/modules/rename.nix | 3 ++- nixos/modules/services/networking/i2pd.nix | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 08146d1f5687..27dde17dbed1 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -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" ]) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index e16ef3beae5c..0463498359b6 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -151,7 +151,7 @@ let i2pdSh = pkgs.writeScriptBin "i2pd" '' #!/bin/sh ${pkgs.i2pd}/bin/i2pd \ - ${if isNull cfg.extIp then "" else "--host="+cfg.extIp} \ + ${if isNull cfg.address then "" else "--host="+cfg.address} \ --conf=${i2pdConf} \ --tunconf=${i2pdTunnelConf} ''; @@ -176,11 +176,11 @@ in ''; }; - extIp = mkOption { + address = mkOption { type = with types; nullOr str; default = null; description = '' - Your external IP. + Your external IP or hostname. ''; }; From 042329be5edfd347fb54705578e5a9bbefffe1c3 Mon Sep 17 00:00:00 2001 From: SLNOS Date: Sat, 1 Jul 2017 00:00:00 +0000 Subject: [PATCH 4/8] nixos: i2pd: one fork less, one process less --- nixos/modules/services/networking/i2pd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 0463498359b6..a6e7cd2d2e15 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -150,7 +150,7 @@ let i2pdSh = pkgs.writeScriptBin "i2pd" '' #!/bin/sh - ${pkgs.i2pd}/bin/i2pd \ + exec ${pkgs.i2pd}/bin/i2pd \ ${if isNull cfg.address then "" else "--host="+cfg.address} \ --conf=${i2pdConf} \ --tunconf=${i2pdTunnelConf} From af5de701b7ea5e97e43ffee4de250dbcbf3b244c Mon Sep 17 00:00:00 2001 From: SLNOS Date: Sat, 1 Jul 2017 00:00:00 +0000 Subject: [PATCH 5/8] nixos: i2pd: add logLevel --- nixos/modules/services/networking/i2pd.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index a6e7cd2d2e15..16c247a3a04c 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -72,6 +72,8 @@ let i2pdConf = pkgs.writeText "i2pd.conf" '' + loglevel = ${cfg.logLevel} + ipv4 = ${boolToString cfg.enableIPv4} ipv6 = ${boolToString cfg.enableIPv6} notransit = ${boolToString cfg.notransit} @@ -176,6 +178,18 @@ in ''; }; + logLevel = mkOption { + type = types.enum ["debug" "info" "warn" "error"]; + default = "error"; + description = '' + The log level. i2pd defaults to "info" + but that generates copious amounts of log messages. + + We default to "error" which is similar to the default log + level of tor. + ''; + }; + address = mkOption { type = with types; nullOr str; default = null; From fd872c9b71d1ef31e0f2895d934126c20f2ce21d Mon Sep 17 00:00:00 2001 From: SLNOS Date: Sat, 1 Jul 2017 00:00:00 +0000 Subject: [PATCH 6/8] nixos: i2pd: enable ElGamal precomputation by default --- nixos/modules/services/networking/i2pd.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 16c247a3a04c..14b98f8f7158 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -275,9 +275,14 @@ in precomputation.elgamal = mkOption { type = types.bool; - default = false; + default = true; description = '' - Use ElGamal precomputated tables. + Whenever to use precomputated tables for ElGamal. + i2pd defaults to false + to save 64M of memory (and looses some performance). + + We default to true as that is what most + users want anyway. ''; }; From 3594c4eec656f3443ee03bd1988c77e6b7ebec4b Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 2 Jul 2017 12:32:07 +0000 Subject: [PATCH 7/8] nixos: i2pd: tiny fix in a description --- nixos/modules/services/networking/i2pd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index 14b98f8f7158..b481f70521b2 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -227,7 +227,7 @@ in default = null; description = '' Set a router bandwidth limit integer in KBps. - If not set, i2pd defaults to 32KBps. + If not set, i2pd defaults to 32KBps. ''; }; From 27aa99753b3a418cea35156d18a354b794d48f48 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Sun, 2 Jul 2017 12:32:17 +0000 Subject: [PATCH 8/8] nixos: i2pd: fix indent --- nixos/modules/services/networking/i2pd.nix | 155 +++++++++++---------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/nixos/modules/services/networking/i2pd.nix b/nixos/modules/services/networking/i2pd.nix index b481f70521b2..5c4932075fed 100644 --- a/nixos/modules/services/networking/i2pd.nix +++ b/nixos/modules/services/networking/i2pd.nix @@ -28,15 +28,15 @@ let }; mkKeyedEndpointOpt = name: addr: port: keyFile: - (mkEndpointOpt name addr port) // { - keys = mkOption { - type = types.str; - default = ""; - description = '' - File to persist ${lib.toUpper name} keys. - ''; + (mkEndpointOpt name addr port) // { + keys = mkOption { + type = types.str; + default = ""; + description = '' + File to persist ${lib.toUpper name} keys. + ''; + }; }; - }; commonTunOpts = let i2cpOpts = { @@ -59,7 +59,7 @@ let description = "Number of ElGamal/AES tags to send."; default = 40; }; - destination = mkOption { + destination = mkOption { type = types.str; description = "Remote endpoint, I2P hostname or b32.i2p address."; }; @@ -70,84 +70,85 @@ let }; } // mkEndpointOpt name "127.0.0.1" 0; - i2pdConf = pkgs.writeText "i2pd.conf" - '' - loglevel = ${cfg.logLevel} + 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} - 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}"} + ipv4 = ${boolToString cfg.enableIPv4} + 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] - transittunnels = ${toString cfg.limits.transittunnels} + [limits] + transittunnels = ${toString cfg.limits.transittunnels} - [upnp] - enabled = ${boolToString cfg.upnp.enable} - name = ${cfg.upnp.name} + [upnp] + enabled = ${boolToString cfg.upnp.enable} + name = ${cfg.upnp.name} - [precomputation] - elgamal = ${boolToString cfg.precomputation.elgamal} + [precomputation] + elgamal = ${boolToString cfg.precomputation.elgamal} - [reseed] - verify = ${boolToString cfg.reseed.verify} - file = ${cfg.reseed.file} - urls = ${builtins.concatStringsSep "," cfg.reseed.urls} + [reseed] + verify = ${boolToString cfg.reseed.verify} + file = ${cfg.reseed.file} + urls = ${builtins.concatStringsSep "," cfg.reseed.urls} - [addressbook] - defaulturl = ${cfg.addressbook.defaulturl} - subscriptions = ${builtins.concatStringsSep "," cfg.addressbook.subscriptions} - ${flip concatMapStrings + [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.name}] - enabled = ${boolToString proto.enable} - address = ${proto.address} - port = ${toString proto.port} - ${if proto ? keys then "keys = ${proto.keys}" else ""} - ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""} - ${if proto ? user then "user = ${proto.user}" else ""} - ${if proto ? pass then "pass = ${proto.pass}" else ""} - ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""} - ${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""} - '') - } + (proto: let portStr = toString proto.port; in '' + [${proto.name}] + enabled = ${boolToString proto.enable} + address = ${proto.address} + port = ${toString proto.port} + ${if proto ? keys then "keys = ${proto.keys}" else ""} + ${if proto ? auth then "auth = ${boolToString proto.auth}" else ""} + ${if proto ? user then "user = ${proto.user}" else ""} + ${if proto ? pass then "pass = ${proto.pass}" else ""} + ${if proto ? outproxy then "outproxy = ${proto.outproxy}" else ""} + ${if proto ? outproxyPort then "outproxyport = ${toString proto.outproxyPort}" else ""} + '') + } ''; i2pdTunnelConf = pkgs.writeText "i2pd-tunnels.conf" '' - ${flip concatMapStrings - (collect (tun: tun ? port && tun ? destination) cfg.outTunnels) - (tun: let portStr = toString tun.port; in '' - [${tun.name}] - type = client - destination = ${tun.destination} - keys = ${tun.keys} - address = ${tun.address} - port = ${toString tun.port} - inbound.length = ${toString tun.inbound.length} - outbound.length = ${toString tun.outbound.length} - inbound.quantity = ${toString tun.inbound.quantity} - outbound.quantity = ${toString tun.outbound.quantity} - crypto.tagsToSend = ${toString tun.crypto.tagsToSend} - '') - } - ${flip concatMapStrings - (collect (tun: tun ? port && tun ? host) cfg.inTunnels) - (tun: let portStr = toString tun.port; in '' - [${tun.name}] - type = server - destination = ${tun.destination} - keys = ${tun.keys} - host = ${tun.address} - port = ${tun.port} - inport = ${tun.inPort} - accesslist = ${builtins.concatStringsSep "," tun.accessList} - '') - } + # 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 '' + [${tun.name}] + type = client + destination = ${tun.destination} + keys = ${tun.keys} + address = ${tun.address} + port = ${toString tun.port} + inbound.length = ${toString tun.inbound.length} + outbound.length = ${toString tun.outbound.length} + inbound.quantity = ${toString tun.inbound.quantity} + outbound.quantity = ${toString tun.outbound.quantity} + crypto.tagsToSend = ${toString tun.crypto.tagsToSend} + '') + } + ${flip concatMapStrings + (collect (tun: tun ? port && tun ? host) cfg.inTunnels) + (tun: let portStr = toString tun.port; in '' + [${tun.name}] + type = server + destination = ${tun.destination} + keys = ${tun.keys} + host = ${tun.address} + port = ${tun.port} + inport = ${tun.inPort} + accesslist = ${builtins.concatStringsSep "," tun.accessList} + '') + } ''; i2pdSh = pkgs.writeScriptBin "i2pd" ''