<commit_before># This module provides the proprietary NVIDIA X11 / OpenGL drivers.

{ config, lib, pkgs, ... }:

let
  inherit (lib)
    elem
    mkIf
    optionals
    optionalString
    singleton;

  drivers = config.services.xserver.videoDrivers;

  # FIXME: should introduce an option like
  # ‘hardware.video.nvidia.package’ for overriding the default NVIDIA
  # driver.
  nvidiaKernelspace = kernelspacePackages:
    if elem "nvidia" drivers || elem "nvidia-long-lived" drivers then
      kernelspacePackages.nvidia-drivers_long-lived
    else if elem "nvidia-short-lived" drivers then
      kernelspacePackages.nvidia-drivers_short-lived
    else if elem "nvidia-beta" drivers then
      kernelspacePackages.nvidia-drivers_beta
    else if elem "nvidia-latest" drivers then
      kernelspacePackages.nvidia-drivers_latest
    else if elem "nvidia-tesla" drivers then
      kernelspacePackages.nvidia-drivers_tesla
    else
      null;

  nvidiaUserspace = nvidiaUserspace:
    if elem "nvidia" drivers || elem "nvidia-long-lived" drivers then
      nvidiaUserspace.nvidia-drivers_long-lived
    else if elem "nvidia-short-lived" drivers then
      nvidiaUserspace.nvidia-drivers_short-lived
    else if elem "nvidia-beta" drivers then
      nvidiaUserspace.nvidia-drivers_beta
    else if elem "nvidia-latest" drivers then
      nvidiaUserspace.nvidia-drivers_latest
    else if elem "nvidia-tesla" drivers then
      nvidiaUserspace.nvidia-drivers_tesla
    else
      null;

  nvidia-drivers_kernelspace = nvidiaKernelspace config.boot.kernelPackages;

  nvidia-drivers_userspace = nvidiaUserspace pkgs;
  nvidia-drivers_userspace_libs32 = (nvidiaUserspace pkgs.pkgs_32).override {
    libsOnly = true;
  };

  enabled =
    nvidia-drivers_kernelspace != null
    && nvidia-drivers_userspace != null;
in

{

  config = mkIf (config.services.xserver.enable && enabled) {

    boot.blacklistedKernelModules = [
      "nouveau"
      "nvidiafb"
      "rivafb"<commit_msg>services/nvidia-drivers: use consistent naming<commit_after># This module provides the proprietary NVIDIA X11 / OpenGL drivers.

{ config, lib, pkgs, ... }:

let
  inherit (lib)
    elem
    mkIf
    optionals
    optionalString
    singleton;

  drivers = config.services.xserver.videoDrivers;

  # FIXME: should introduce an option like
  # ‘hardware.video.nvidia.package’ for overriding the default NVIDIA
  # driver.
  nvidiaKernelspace = kernelspacePackages:
    if elem "nvidia" drivers || elem "nvidia-long-lived" drivers then
      kernelspacePackages.nvidia-drivers_long-lived
    else if elem "nvidia-short-lived" drivers then
      kernelspacePackages.nvidia-drivers_short-lived
    else if elem "nvidia-beta" drivers then
      kernelspacePackages.nvidia-drivers_beta
    else if elem "nvidia-latest" drivers then
      kernelspacePackages.nvidia-drivers_latest
    else if elem "nvidia-tesla" drivers then
      kernelspacePackages.nvidia-drivers_tesla
    else
      null;

  nvidiaUserspace = userspacePackages:
    if elem "nvidia" drivers || elem "nvidia-long-lived" drivers then
      userspacePackages.nvidia-drivers_long-lived
    else if elem "nvidia-short-lived" drivers then
      userspacePackages.nvidia-drivers_short-lived
    else if elem "nvidia-beta" drivers then
      userspacePackages.nvidia-drivers_beta
    else if elem "nvidia-latest" drivers then
      userspacePackages.nvidia-drivers_latest
    else if elem "nvidia-tesla" drivers then
      userspacePackages.nvidia-drivers_tesla
    else
      null;

  nvidia-drivers_kernelspace = nvidiaKernelspace config.boot.kernelPackages;

  nvidia-drivers_userspace = nvidiaUserspace pkgs;
  nvidia-drivers_userspace_libs32 = (nvidiaUserspace pkgs.pkgs_32).override {
    libsOnly = true;
  };

  enabled =
    nvidia-drivers_kernelspace != null
    && nvidia-drivers_userspace != null;
in

{

  config = mkIf (config.services.xserver.enable && enabled) {

    boot.blacklistedKernelModules = [
      "nouveau"
      "nvidiafb"
      "rivafb"
{'fraction_non_alphanumeric': 0.07726931732933233, 'fraction_numerical': 0.003000750187546887, 'mean_word_length': 3.4742729306487696, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4660004', 'n_tokens_mistral': 1420, 'n_tokens_neox': 1253, 'n_words': 288}