Unverified Commit 788c69d8 authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #331038 from K900/i2pd-fix-for-real

nixos/i2pd: actually fix, clean up a little bit
parents cdeee848 7f2ec487
Loading
Loading
Loading
Loading
+38 −30
Original line number Diff line number Diff line
@@ -183,11 +183,10 @@ let
  in
    pkgs.writeText "i2pd.conf" (concatStringsSep "\n" opts);

  tunnelConf = let opts = [
    notice
    (flip map
      (collect (tun: tun ? port && tun ? destination) cfg.outTunnels)
      (tun: let outTunOpts = [
  tunnelConf = let
    mkOutTunnel = tun:
      let
        outTunOpts = [
          (sec tun.name)
          "type = client"
          (intOpt "port" tun.port)
@@ -200,10 +199,12 @@ let
          ++ (optionals (tun ? outbound.length) (optionalNullInt "outbound.length" tun.outbound.length))
          ++ (optionals (tun ? outbound.quantity) (optionalNullInt "outbound.quantity" tun.outbound.quantity))
          ++ (optionals (tun ? crypto.tagsToSend) (optionalNullInt "crypto.tagstosend" tun.crypto.tagsToSend));
        in concatStringsSep "\n" outTunOpts))
    (flip map
      (collect (tun: tun ? port && tun ? address) cfg.inTunnels)
      (tun: let inTunOpts = [
      in
        concatStringsSep "\n" outTunOpts;

    mkInTunnel = tun:
      let
        inTunOpts = [
          (sec tun.name)
          "type = server"
          (intOpt "port" tun.port)
@@ -212,8 +213,15 @@ let
          ++ (optionals (tun ? keys) (optionalNullString "keys" tun.keys))
          ++ (optionals (tun ? inPort) (optionalNullInt "inport" tun.inPort))
          ++ (optionals (tun ? accessList) (optionalEmptyList "accesslist" tun.accessList));
        in concatStringsSep "\n" inTunOpts))];
    in pkgs.writeText "i2pd-tunnels.conf" (concatStringsSep "\n" opts);
      in
        concatStringsSep "\n" inTunOpts;

    allOutTunnels = collect (tun: tun ? port && tun ? destination) cfg.outTunnels;
    allInTunnels = collect (tun: tun ? port && tun ? address) cfg.inTunnels;

    opts = [ notice ] ++ (map mkOutTunnel allOutTunnels) ++ (map mkInTunnel allInTunnels);
  in
    pkgs.writeText "i2pd-tunnels.conf" (concatStringsSep "\n" opts);

  i2pdFlags = concatStringsSep " " (
    optional (cfg.address != null) ("--host=" + cfg.address) ++ [