Monday, December 15, 2008

Gentoo: How-to emerge the latest beta nvidia driver with portage and layman

UPDATE: this guide is now obsolete, since 180.22 is in ~arch. however new drivers come and go every day so maybe it'll be useful for someone in the future!

The nvidia-drivers package in gentoo ~arch lags behind the latest official beta from nVidia.

In this post I'll show you how to install the latest nvidia driver through Gentoo's overlays. Most of the stuff you'll do here is a one-time operation, meaning you won't have to do it again the next time an update rolls out.

To begin, we need to be able to add overlays. Gentoo has "layman" for this job.

emerge -av layman

make sure git and subversion USE flags are enabled

when that's done, you'll need a list with all the available overlays:

layman -L

now its time to add an overlay. the commands for adding/deleting overlays are layman -a overlay and layman -d overlay

There are currently two overlays with the latest nvidia-driver ebuilds available, berkano and voyageur.

We'll randomly go with berkano now but you can choose whichever you want. I have them both since they provide other stuff too.

Add the overlay:

layman -a berkano

when its done, we need to add a line in make.conf to let portage know we've activated layman:

echo "source /usr/local/portage/layman/make.conf" >> /etc/make.conf

NOTE: depending on the configuration, your layman installation might be in /usr/portage/local/layman/ - adjust this guide as needed :)

If you're inserting the line manually, make sure its the last line in the file!

If we are running on stable, portage will ignore the new nvidia-drivers by default. We simply need to add some lines to unmask them:

echo "x11-drivers/nvidia-drivers" >> /etc/portage/package.unmask
echo "x11-drivers/nvidia-drivers **" >> /etc/portage/package.keywords


** BEWARE ** If you have switched /etc/portage/package.* to a directory structure the above commands will destroy everything, so take care and adjust them if necessary (most users don't have to worry here)

Now we are ready to install or update to the new nvidia-drivers

emerge -av nvidia-drivers

and portage takes care of the rest:

wired@cloud ~ $ sudo emerge -av nvidia-drivers

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] x11-drivers/nvidia-drivers-180.16 USE="acpi custom-cflags gtk (multilib)" 0 kB [1]

Total: 1 package (1 reinstall), Size of downloads: 0 kB
Portage tree and overlays:
[0] /usr/portage
[1] /usr/local/portage/layman/voyageur

Would you like to merge these packages? [Yes/No]


Please note that the overlays contain other stuff that are not masked if you are running ~arch (testing) and will be updated if you emerge world. You'll need to mask everything you may want to avoid (i.e. mplayer-9999);

To mask mplayer-9999 (adjust the same command for any package):

echo ">=media-video/mplayer-9999" >> /etc/portage/package.mask

Thats it! You're now running the latest and greatest nvidia-driver.
Here's my xorg.conf for reference. I don't use aiglx, desktop effects or compiz, but these settings make 2D blazingly fast for me - you may have to experiment with them to find what works best for you - 180.16 is really a good driver release =)

There's one thing left though: updating!

Overlays need to be synced like the main portage tree. To sync all overlays, simply run

layman -S

preferably alongside emerge --sync. after this is done,

emerge -avDuN world

will include overlay updates (yeah, nvidia updates too ;))

Enjoy!

3 comments:

Noah said...

Thanks for the great post! Definitely improved my 2D performance a lot.

For me, though, the path to the layman make.conf is wrong. Rather than /usr/local/portage/layman/make.conf, I need to use /usr/portage/local/layman/make.conf (the portage and local directories are flipped). I figured this out thanks to here: http://article.gmane.org/gmane.linux.gentoo.proaudio/2643.

Anyway, thought it might help someone else out!

Wired said...

I have my local overlay in /usr/local/portage, maybe thats why our layman directories are different. I'll update the guide to reflect that :)

Andy said...

Thanks a bunch, this helped greatly in learning about the layman command and adding overlays to portage.