linuxPackages_5_10.nvidia_x11 # attribute 'extend' missing, at /nix/kernel.nix:40:31

How to use linuxPackages_5_10.nvidia_x11 ?

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.100, NixOS, 20.09.3415.2821518e360 (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.10`
 - channels(user): `"nixos-20.09.2152.e34208e1003"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

nixos configuration:
kernelPackages = pkgs.linuxPackages_5_10.nvidia_x11 ;
results in :
sudo nixos-rebuild build --show-trace

building Nix...
building the system configuration...
error: while evaluating the attribute 'config.system.build.toplevel' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/to
p-level.nix:293:5:
while evaluating 'foldr' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:52:20, called from /nix/var/nix/profiles/per-user/root/channels/
nixos/nixos/modules/system/activation/top-level.nix:128:12:
while evaluating 'fold'' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/lists.nix:55:15, called from /nix/var/nix/profiles/per-user/root/channels/
nixos/lib/lists.nix:59:8:
while evaluating the attribute 'assertions' at undefined position:
while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:276:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:98:72, called from /nix/var/nix/profiles/per-user/r
oot/channels/nixos/lib/attrsets.nix:279:20:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:465:9:
while evaluating the option `assertions':
while evaluating the attribute 'mergedValue' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:497:5:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:491:9:
while evaluating the attribute 'values' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:590:7:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:477:28, called from /nix/var/nix/profiles/per-user/
root/channels/nixos/lib/modules.nix:477:17:
while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/kernel.nix':
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:549:25, called from /nix/var/nix/profiles/per-us
er/root/channels/nixos/lib/modules.nix:478:137:
while evaluating 'dischargeProperties' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:549:25, called from /nix/var/nix/profiles/per-us
er/root/channels/nixos/lib/modules.nix:555:11:
while evaluating the attribute 'content' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:633:14:
while evaluating the attribute 'boot.kernelPackages.kernel' at undefined position:
while evaluating 'g' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:276:19, called from undefined position:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:98:72, called from /nix/var/nix/profiles/per-user/r
oot/channels/nixos/lib/attrsets.nix:279:20:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:465:9:
while evaluating the option `boot.kernelPackages':
while evaluating 'apply' at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/kernel.nix:40:15, called from /nix/var/nix/profiles/
per-user/root/channels/nixos/lib/modules.nix:458:35:
attribute 'extend' missing, at /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/kernel.nix:40:31

kernelPackages is for setting the kernel package set that should be used, e.g.:

kernelPackages = pkgs.linuxPackages_5_10;

You can enable the NVIDIA driver with:

services.xserver.videoDrivers = [ "nvidia" ];

This adds the kernel module to the configuration and sets up X11 to use the driver.

1 Like

thanks for your fast response

  • that’s what I had - till I saw:

What is “that package” for?

It contains the driver, their OpenGL, Vulkan runtimes, etc. But several things need to be done to properly use it, the drivers need to be used as a driver package, the libraries need to be made visible in /run/opengl-driver, etc. services.xserver.videoDrivers = [ "nvidia" ]; does all that for you.

sorry but I still not yet get it. (but don’t matter too much)

if I check for the string ‘linuxPackages_5_10.nvidia_x11’ in nixpkgs repo → there is no result

  • where does the search take that package from?

“But several things need to be done to properly use it”

  • the package is listed but “not yet usable”?

There is a function linuxPackagesFor that generates a kernel package set (containing kernel module packages, etc.) for a given kernel package. E.g.:

linuxPackages_5_10 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_5_10);

If you had your own kernel package called linux_igel, you could create the package set with linuxPackagesFor linux_igel.