anchor.diff:  let
     cfg = config.services.elasticsearch;
   
  -  es_home = "/var/lib/elasticsearch";
  -
  -  configFile = pkgs.writeText "elasticsearch.yml" ''
  +  esConfig = ''
       network.host: ${cfg.host}
  -    network.port: ${cfg.port}
  -    network.tcp.port: ${cfg.tcp_port}
  +    network.port: ${toString cfg.port}
  +    network.tcp.port: ${toString cfg.tcp_port}
       cluster.name: ${cfg.cluster_name}
       ${cfg.extraConf}
     '';
  +
  +  configDir = pkgs.buildEnv {
  +    name = "elasticsearch-config";
  +    paths = [
  +      (pkgs.writeTextDir "elasticsearch.yml" esConfig)
  +      (pkgs.writeTextDir "logging.yml" cfg.logging)
  +    ];
  +  };
   
   in {
   
  
positive.code:       '';
        type = types.str;
      };
    };
  
    ###### implementation
  
    config = mkIf cfg.enable {
      environment.etc = [
        { source = configFile;
          target = "elasticsearch/elasticsearch.yml"; }
        { source = pkgs.writeText "logging.yml" cfg.logging;
          target = "elasticsearch/logging.yml"; }
      ];
  
      systemd.services.elasticsearch = {
        description = "Elasticsearch daemon";
        wantedBy = [ "multi-user.target" ];
        after = [ "network-interfaces.target" ];
        environment = { ES_HOME = es_home; };
        serviceConfig = {
          ExecStart = "${pkgs.elasticsearch}/bin/elasticsearch -f -Des.path.conf=/etc/elasticsearch";
          User = "elasticsearch";
        };
      };
  
      environment.systemPackages = [ pkgs.elasticsearch ];
  
negative.code: 
      port = mkOption {
        description = "Elasticsearch port to listen for HTTP traffic";
        default = 9200;
        type = types.int;
      };
  
      tcp_port = mkOption {
        description = "Elasticsearch port for the node to node communication";
        default = 9300;
        type = types.int;
      };
  
      cluster_name = mkOption {
  