anchor.diff:    run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} postgres";
   
     flags = if cfg.enableTCPIP then ["-i"] else [];
  +
  +  # The main PostgreSQL configuration file.
  +  configFile = pkgs.writeText "postgresql.conf"
  +    ''
  +      hba_file = '${pkgs.writeText "pg_hba.conf" cfg.authentication}'
  +      ident_file = '${pkgs.writeText "pg_ident.conf" cfg.identMap}'
  +      log_destination = 'syslog'
  +    '';  
   
   in
   
  
positive.code:                 mkdir -m 0700 -p ${cfg.dataDir}
                  chown -R postgres ${cfg.dataDir}
                  ${run} -c '${postgresql}/bin/initdb -U root'
              fi
              
              cp -f ${pkgs.writeText "pg_hba.conf" cfg.authentication} ${cfg.dataDir}/pg_hba.conf
  
              # We'd like to use the `-w' flag here to wait until the
              # database is up, but it requires a `postgres' user to
  
negative.code:           host  all all ::1/128      md5
          '';
          description = ''
            Defines how users authenticate themselves to the server.
          '';
        };
        
        identMap = mkOption {
          default = "";
          description = ''
            Defines the mapping from system users to database users.
          '';
        };
        
  