anchor.diff:        extraFlags = mkOption {
           type = types.listOf types.str;
           description = "Extra flags passed to the IPFS daemon";
  -        default = [];
  +        default = [ ];
         };
   
         localDiscovery = mkOption {
  
positive.code:   opt = options.services.ipfs;
  
    ipfsFlags = toString ([
      (optionalString  cfg.autoMount                   "--mount")
      (optionalString  cfg.enableGC                    "--enable-gc")
      (optionalString (cfg.serviceFdlimit != null)     "--manage-fdlimit=false")
      (optionalString (cfg.defaultMode == "offline")   "--offline")
      (optionalString (cfg.defaultMode == "norouting") "--routing=none")
    ] ++ cfg.extraFlags);
  
    splitMulitaddr = addrRaw: lib.tail (lib.splitString "/" addrRaw);
  
    multiaddrToListenStream = addrRaw: let
        addr = splitMulitaddr addrRaw;
        s = builtins.elemAt addr;
      in if s 0 == "ip4" && s 2 == "tcp"
        then "${s 1}:${s 3}"
      else if s 0 == "ip6" && s 2 == "tcp"
        then "[${s 1}]:${s 3}"
      else if s 0 == "unix"
        then "/${lib.concatStringsSep "/" (lib.tail addr)}"
      else null; # not valid for listen stream, skip
  
    multiaddrToListenDatagram = addrRaw: let
        addr = splitMulitaddr addrRaw;
        s = builtins.elemAt addr;
      in if s 0 == "ip4" && s 2 == "udp"
        then "${s 1}:${s 3}"
      else if s 0 == "ip6" && s 2 == "udp"
        then "[${s 1}]:${s 3}"
      else null; # not valid for listen datagram, skip
  
  in {
  
    ###### interface
  
  
negative.code:     systemd.sockets.ipfs-gateway = {
        wantedBy = [ "sockets.target" ];
        socketConfig = {
          ListenStream =
            let
              fromCfg = multiaddrToListenStream cfg.gatewayAddress;
            in
            [ "" ] ++ lib.optional (fromCfg != null) fromCfg;
          ListenDatagram =
            let
              fromCfg = multiaddrToListenDatagram cfg.gatewayAddress;
            in
            [ "" ] ++ lib.optional (fromCfg != null) fromCfg;
        };
      };
  
  