First install Xorg. You should have compiled your kernel and the nvidia module keeping in mind the need to run Xorg.

emacs /etc/make.conf

Changes to make.conf:

emerge -pv xorg-drivers
emerge xorg-server
source /etc/profile

Finally try a startx
If you momentarily get a blank screen, X may be setup correctly. Can test with emerge twm (but remeber to unmerge them)

emerge -av kde-meta

If there are use changed you need to write:

emerge -av kde-meta --autounmask-write

(Watch for another command which writes merges the changes to config files)

After installing and compiling packages of KDE, we can try to start kdm


If all went well, KDE should start. I got a few errors with dbus and consolekit, which caused KDM to show windows without the resize/min/max buttons, and a few error message popups.

Consolekit session failed to connect to socket.

Solved by:
First see if dbus starts fine:
/etc/init.d/dbus restart

If it does, then:
rc-update add dbus default
rc-update add consolekit default

To make KDM start automatically at boot:
sudo emacs /etc/rc.conf

Add the line:

Then add xdm to default runlevel:

rc-update add xdm default