NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.6k forks source link

Build failure: Nvidia legacy_390 generic.nix:237 is marked as broken, refusing to evaluate. #329082

Open Raul824 opened 1 month ago

Raul824 commented 1 month ago

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create nvidia.nix with below content.
{ pkgs, config, libs, ... }:

{

# Enable OpenGL
  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

  # Load nvidia driver for Xorg and Wayland
  services.xserver.videoDrivers = ["nvidia"];

  hardware.nvidia = {

    # Modesetting is required.
    modesetting.enable = true;

    # Nvidia power management. Experimental, and can cause sleep/suspend to fail.
    powerManagement.enable = false;
    # Fine-grained power management. Turns off GPU when not in use.
    # Experimental and only works on modern Nvidia GPUs (Turing or newer).
    powerManagement.finegrained = false;

    # Use the NVidia open source kernel module (not to be confused with the
    # independent third-party "nouveau" open source driver).
    # Support is limited to the Turing and later architectures. Full list of 
    # supported GPUs is at: 
    # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 
    # Only available from driver 515.43.04+
    # Currently alpha-quality/buggy, so false is currently the recommended setting.
    open = false;

    # Enable the Nvidia settings menu,
    # accessible via `nvidia-settings`.
    nvidiaSettings = true;

    # Optionally, you may need to select the appropriate driver version for your specific GPU.
    package = config.boot.kernelPackages.nvidiaPackages.legacy_390;

  };

}
  1. add nvidia.nix in imports.
  2. run nixos-rebuild switch

Build log

error:
       … while calling the 'head' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Package ‘nvidia-x11-390.157-6.6.41’ in /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/os-specific/linux/nvidia-x11/generic.nix:237 is marked as broken, refusing to evaluate.

Additional context

Add any other context about the problem here.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a :+1: reaction to issues you find important.

ghpzin commented 1 month ago

Custom error with reason could be better, but it is only marked broken for kernel 6.2 and later, because it's officially out of support by nvidia. You can still use it with 6.1 kernel.

https://github.com/NixOS/nixpkgs/blob/f11a6a01cb5e2ceaa40bdc28d492bd2fd8b2a847/pkgs/os-specific/linux/nvidia-x11/default.nix#L131-L138

Some comments about reasons on commit that marked it broken: https://github.com/NixOS/nixpkgs/commit/0b14e79f1ca4b1722d222d8a089f5ee961be1a91