anchor.diff:          '';
         };
   
  -      rpcCertificate = mkOption {
  +      extraNodes = mkOption {
  +        type = types.listOf types.str;
  +        default = [ ];
  +        description = ''
  +          List of additional peer IP addresses to connect to.
  +        '';
  +      };
  +
  +      trustedNodes = mkOption {
  +        type = types.listOf types.str;
  +        default = [ ];
  +        description = ''
  +          List of the only peer IP addresses to connect to. If specified
  +          no other connection will be made.
  +        '';
  +      };
  +
  +      rpc.user = mkOption {
  +        type = types.nullOr types.str;
  +        default = null;
  +        description = ''
  +          User name for RPC connections.
  +        '';
  +      };
  +
  +      rpc.password = mkOption {
  +        type = types.str;
  +        default = null;
  +        description = ''
  +          Password for RPC connections.
  +        '';
  +      };
  +
  +      rpc.address = mkOption {
  +        type = types.str;
  +        default = "0.0.0.0";
  +        description = ''
  +          IP address the RPC server will bind to.
  +        '';
  +      };
  +
  +      rpc.port = mkOption {
  +        type = types.int;
  +        default = 8332;
  +        description = ''
  +          Port the RPC server will bind to.
  +        '';
  +      };
  +
  +      rpc.certificate = mkOption {
           type = types.nullOr types.path;
           default = null;
  -        example = "/etc/namecoin/server.cert";
  +        example = "/var/lib/namecoind/server.cert";
           description = ''
             Certificate file for securing RPC connections.
           '';
         };
   
  -      rpcKey = mkOption {
  +      rpc.key = mkOption {
           type = types.nullOr types.path;
           default = null;
  -        example = "/etc/namecoin/server.pem";
  +        example = "/var/lib/namecoind/server.pem";
           description = ''
             Key file for securing RPC connections.
           '';
         };
   
  +
  +      rpc.allowFrom = mkOption {
  +        type = types.listOf types.str;
  +        default = [ "127.0.0.1" ];
  +        description = ''
  +          List of IP address ranges allowed to use the RPC API.
  +          Wiledcards (*) can be user to specify a range.
  +        '';
  +      };
  +
       };
   
     };
  
positive.code: with lib;
  
  let
    cfg = config.services.namecoind;
  
    namecoinConf =
    let
      useSSL = (cfg.rpcCertificate != null) && (cfg.rpcKey != null);
    in
    pkgs.writeText "namecoin.conf" ''
      server=1
      daemon=0
      rpcallowip=127.0.0.1
      walletpath=${cfg.wallet}
      gen=${if cfg.generate then "1" else "0"}
      rpcssl=${if useSSL then "1" else "0"}
      ${optionalString useSSL "rpcsslcertificatechainfile=${cfg.rpcCertificate}"}
      ${optionalString useSSL "rpcsslprivatekeyfile=${cfg.rpcKey}"}
      ${optionalString useSSL "rpcsslciphers=TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH"}
      txindex=1
      txprevcache=1
    '';
  
  in
  
  
negative.code: 
      services.namecoind = {
  
        enable = mkEnableOption "namecoind, Namecoin client.";
  
        wallet = mkOption {
          type = types.path;
          default = "${dataDir}/wallet.dat";
          description = ''
            Wallet file. The ownership of the file has to be
            namecoin:namecoin, and the permissions must be 0640.
          '';
        };
  
  