nixos: i2pd, change to yes/no config entries and explicitly enable client endpoints
This commit is contained in:
parent
e433a3015a
commit
c65026bfa5
@ -10,9 +10,10 @@ let
|
|||||||
|
|
||||||
extip = "EXTIP=\$(${pkgs.curl}/bin/curl -sf \"http://jsonip.com\" | ${pkgs.gawk}/bin/awk -F'\"' '{print $4}')";
|
extip = "EXTIP=\$(${pkgs.curl}/bin/curl -sf \"http://jsonip.com\" | ${pkgs.gawk}/bin/awk -F'\"' '{print $4}')";
|
||||||
|
|
||||||
toOneZero = b: if b then "1" else "0";
|
toYesNo = b: if b then "yes" else "no";
|
||||||
|
|
||||||
mkEndpointOpt = name: addr: port: {
|
mkEndpointOpt = name: addr: port: {
|
||||||
|
enable = mkEnableOption name;
|
||||||
name = mkOption {
|
name = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = name;
|
default = name;
|
||||||
@ -63,9 +64,9 @@ 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" ''
|
||||||
ipv6 = ${toOneZero cfg.enableIPv6}
|
ipv6 = ${toYesNo cfg.enableIPv6}
|
||||||
notransit = ${toOneZero cfg.notransit}
|
notransit = ${toYesNo cfg.notransit}
|
||||||
floodfill = ${toOneZero cfg.floodfill}
|
floodfill = ${toYesNo cfg.floodfill}
|
||||||
${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
|
${if isNull cfg.port then "" else "port = ${toString cfg.port}"}
|
||||||
${flip concatMapStrings
|
${flip concatMapStrings
|
||||||
(collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
|
(collect (proto: proto ? port && proto ? address && proto ? name) cfg.proto)
|
||||||
@ -73,6 +74,7 @@ let
|
|||||||
[${proto.name}]
|
[${proto.name}]
|
||||||
address = ${proto.address}
|
address = ${proto.address}
|
||||||
port = ${toString proto.port}
|
port = ${toString proto.port}
|
||||||
|
enabled = ${toYesNo proto.enable}
|
||||||
'')
|
'')
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user