nixos/i2pd: address #63103

As a comment to 1d61efb7f1
Note that collect returns a list from a set
This commit is contained in:
Edward Tjörnhammar 2020-02-19 13:10:26 +01:00
parent 482642a733
commit 9bab9e2ec6
No known key found for this signature in database
GPG Key ID: 577898458385603E

View File

@ -158,10 +158,10 @@ let
(sec "addressbook") (sec "addressbook")
(strOpt "defaulturl" cfg.addressbook.defaulturl) (strOpt "defaulturl" cfg.addressbook.defaulturl)
] ++ (optionalEmptyList "subscriptions" cfg.addressbook.subscriptions) ] ++ (optionalEmptyList "subscriptions" cfg.addressbook.subscriptions)
++ (flip mapAttrs ++ (flip map
(collect (name: proto: proto ? port && proto ? address && proto ? name) cfg.proto) (collect (proto: proto ? port && proto ? address) cfg.proto)
(proto: let protoOpts = [ (proto: let protoOpts = [
(sec name) (sec proto.name)
(boolOpt "enabled" proto.enable) (boolOpt "enabled" proto.enable)
(strOpt "address" proto.address) (strOpt "address" proto.address)
(intOpt "port" proto.port) (intOpt "port" proto.port)
@ -181,10 +181,10 @@ let
tunnelConf = let opts = [ tunnelConf = let opts = [
notice notice
(flip mapAttrs (flip map
(collect (name: tun: tun ? port && tun ? destination) cfg.outTunnels) (collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
(tun: let outTunOpts = [ (tun: let outTunOpts = [
(sec name) (sec tun.name)
"type = client" "type = client"
(intOpt "port" tun.port) (intOpt "port" tun.port)
(strOpt "destination" tun.destination) (strOpt "destination" tun.destination)
@ -204,10 +204,10 @@ let
++ (if tun ? crypto.tagsToSend then ++ (if tun ? crypto.tagsToSend then
optionalNullInt "crypto.tagstosend" tun.crypto.tagsToSend else []); optionalNullInt "crypto.tagstosend" tun.crypto.tagsToSend else []);
in concatStringsSep "\n" outTunOpts)) in concatStringsSep "\n" outTunOpts))
(flip mapAttrs (flip map
(collect (name: tun: tun ? port && tun ? address) cfg.inTunnels) (collect (tun: tun ? port && tun ? address) cfg.inTunnels)
(tun: let inTunOpts = [ (tun: let inTunOpts = [
(sec name) (sec tun.name)
"type = server" "type = server"
(intOpt "port" tun.port) (intOpt "port" tun.port)
(strOpt "host" tun.address) (strOpt "host" tun.address)
@ -606,7 +606,7 @@ in
outTunnels = mkOption { outTunnels = mkOption {
default = {}; default = {};
type = with types; loaOf (submodule ( type = with types; attrsOf (submodule (
{ name, ... }: { { name, ... }: {
options = { options = {
destinationPort = mkOption { destinationPort = mkOption {
@ -627,7 +627,7 @@ in
inTunnels = mkOption { inTunnels = mkOption {
default = {}; default = {};
type = with types; loaOf (submodule ( type = with types; attrsOf (submodule (
{ name, ... }: { { name, ... }: {
options = { options = {
inPort = mkOption { inPort = mkOption {