mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-17 07:13:23 +01:00
Merge pull request #172660 from NickCao/nvidia-open
nvidia-open: init at 515.43.04
This commit is contained in:
commit
4cf04594a9
8 changed files with 87 additions and 7 deletions
|
@ -36,6 +36,18 @@
|
|||
PHP now defaults to PHP 8.1, updated from 8.0.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>hardware.nvidia</literal> has a new option
|
||||
<literal>open</literal> that can be used to opt in the
|
||||
opensource version of NVIDIA kernel driver. Note that the
|
||||
driver’s support for GeForce and Workstation GPUs is still
|
||||
alpha quality, see
|
||||
<link xlink:href="https://developer.nvidia.com/blog/nvidia-releases-open-source-gpu-kernel-modules/">NVIDIA
|
||||
Releases Open-Source GPU Kernel Modules</link> for the
|
||||
official announcement.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
<section xml:id="sec-release-22.11-new-services">
|
||||
|
|
|
@ -19,6 +19,8 @@ In addition to numerous new and upgraded packages, this release has the followin
|
|||
|
||||
- PHP now defaults to PHP 8.1, updated from 8.0.
|
||||
|
||||
- `hardware.nvidia` has a new option `open` that can be used to opt in the opensource version of NVIDIA kernel driver. Note that the driver's support for GeForce and Workstation GPUs is still alpha quality, see [NVIDIA Releases Open-Source GPU Kernel Modules](https://developer.nvidia.com/blog/nvidia-releases-open-source-gpu-kernel-modules/) for the official announcement.
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
## New Services {#sec-release-22.11-new-services}
|
||||
|
|
|
@ -183,6 +183,14 @@ in
|
|||
'';
|
||||
example = literalExpression "config.boot.kernelPackages.nvidiaPackages.legacy_340";
|
||||
};
|
||||
|
||||
hardware.nvidia.open = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to use the open source kernel module
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
|
@ -231,6 +239,11 @@ in
|
|||
);
|
||||
message = "Required files for driver based power management don't exist.";
|
||||
}
|
||||
|
||||
{
|
||||
assertion = cfg.open -> (cfg.package ? open && cfg.package ? firmware);
|
||||
message = "This version of NVIDIA driver does not provide a corresponding opensource kernel driver";
|
||||
}
|
||||
];
|
||||
|
||||
# If Optimus/PRIME is enabled, we:
|
||||
|
@ -364,7 +377,8 @@ in
|
|||
++ optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia)
|
||||
"L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced";
|
||||
|
||||
boot.extraModulePackages = [ nvidia_x11.bin ];
|
||||
boot.extraModulePackages = if cfg.open then [ nvidia_x11.open ] else [ nvidia_x11.bin ];
|
||||
hardware.firmware = lib.optional cfg.open nvidia_x11.firmware;
|
||||
|
||||
# nvidia-uvm is required by CUDA applications.
|
||||
boot.kernelModules = [ "nvidia-uvm" ] ++
|
||||
|
@ -372,7 +386,8 @@ in
|
|||
|
||||
# If requested enable modesetting via kernel parameter.
|
||||
boot.kernelParams = optional (offloadCfg.enable || cfg.modesetting.enable) "nvidia-drm.modeset=1"
|
||||
++ optional cfg.powerManagement.enable "nvidia.NVreg_PreserveVideoMemoryAllocations=1";
|
||||
++ optional cfg.powerManagement.enable "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||
++ optional cfg.open "nvidia.NVreg_OpenRmEnableUnsupportedGpus=1";
|
||||
|
||||
services.udev.extraRules =
|
||||
''
|
||||
|
|
|
@ -147,6 +147,11 @@ installPhase() {
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$firmware" ]; then
|
||||
# Install the GSP firmware
|
||||
install -Dm644 firmware/gsp.bin $firmware/lib/firmware/nvidia/$version/gsp.bin
|
||||
fi
|
||||
|
||||
# All libs except GUI-only are installed now, so fixup them.
|
||||
for libname in $(find "$out/lib/" $(test -n "$lib32" && echo "$lib32/lib/") $(test -n "$bin" && echo "$bin/lib/") -name '*.so.*')
|
||||
do
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
let
|
||||
generic = args: let
|
||||
imported = import ./generic.nix args;
|
||||
in if lib.versionAtLeast args.version "391"
|
||||
&& stdenv.hostPlatform.system != "x86_64-linux" then null
|
||||
else callPackage imported {
|
||||
in callPackage imported {
|
||||
lib32 = (pkgsi686Linux.callPackage imported {
|
||||
libsOnly = true;
|
||||
kernel = null;
|
||||
|
@ -21,6 +19,7 @@ rec {
|
|||
then generic {
|
||||
version = "515.48.07";
|
||||
sha256_64bit = "sha256-4odkzFsTwy52NwUT2ur8BcKJt37gURVSRQ8aAOMa4eM=";
|
||||
openSha256 = "sha256-EGIrdabPr+AhQxXhFb8XXumuPxC+U6XEeIeSYFvA/q4=";
|
||||
settingsSha256 = "sha256-XwdMsAAu5132x2ZHqjtFvcBJk6Dao7I86UksxrOkknU=";
|
||||
persistencedSha256 = "sha256-BTfYNDJKe4tOvV71/1JJSPltJua0Mx/RvDcWT5ccRRY=";
|
||||
}
|
||||
|
@ -32,6 +31,7 @@ rec {
|
|||
beta = generic {
|
||||
version = "515.43.04";
|
||||
sha256_64bit = "sha256-PodaTTUOSyMW8rtdtabIkSLskgzAymQyfToNlwxPPcc=";
|
||||
openSha256 = "sha256-1bAr5dWZ4jnY3Uo2JaEz/rhw2HuW9LZ5bACmA1VG068=";
|
||||
settingsSha256 = "sha256-j47LtP6FNTPfiXFh9KwXX8vZOQzlytA30ZfW9N5F2PY=";
|
||||
persistencedSha256 = "sha256-hULBy0wnVpLH8I0L6O9/HfgvJURtE2whpXOgN/vb3Wo=";
|
||||
};
|
||||
|
@ -46,6 +46,7 @@ rec {
|
|||
settingsSha256 = "sha256-fq6RlD6g3uylvvTjE4MmaQwxPJYU0u6IMfpPVzks0tI=";
|
||||
persistencedSha256 = "sha256-eHvauvh8Wd+b8DK6B3ZWNjoWGztupWrR8iog9ok58io=";
|
||||
url = "https://developer.nvidia.com/vulkan-beta-${lib.concatStrings (lib.splitString "." version)}-linux";
|
||||
broken = kernel.kernelAtLeast "5.17";
|
||||
};
|
||||
|
||||
# Update note:
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
, url ? null
|
||||
, sha256_32bit ? null
|
||||
, sha256_64bit
|
||||
, openSha256 ? null
|
||||
, settingsSha256
|
||||
, settingsVersion ? version
|
||||
, persistencedSha256
|
||||
|
@ -27,13 +28,14 @@
|
|||
disable32Bit ? false
|
||||
# 32 bit libs only version of this package
|
||||
, lib32 ? null
|
||||
# Whether to extract the GSP firmware
|
||||
, firmware ? openSha256 != null
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
assert !libsOnly -> kernel != null;
|
||||
assert versionOlder version "391" -> sha256_32bit != null;
|
||||
assert versionAtLeast version "391" -> stdenv.hostPlatform.system == "x86_64-linux";
|
||||
|
||||
let
|
||||
nameSuffix = optionalString (!libsOnly) "-${kernel.version}";
|
||||
|
@ -72,7 +74,8 @@ let
|
|||
|
||||
outputs = [ "out" ]
|
||||
++ optional i686bundled "lib32"
|
||||
++ optional (!libsOnly) "bin";
|
||||
++ optional (!libsOnly) "bin"
|
||||
++ optional (!libsOnly && firmware) "firmware";
|
||||
outputDev = if libsOnly then null else "bin";
|
||||
|
||||
kernel = if libsOnly then null else kernel.dev;
|
||||
|
@ -100,6 +103,7 @@ let
|
|||
disallowedReferences = optional (!libsOnly) [ kernel.dev ];
|
||||
|
||||
passthru = {
|
||||
open = mapNullable (hash: callPackage (import ./open.nix self hash) { }) openSha256;
|
||||
settings = (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) {
|
||||
withGtk2 = preferGtk2;
|
||||
withGtk3 = !preferGtk2;
|
||||
|
|
37
pkgs/os-specific/linux/nvidia-x11/open.nix
Normal file
37
pkgs/os-specific/linux/nvidia-x11/open.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
nvidia_x11: hash:
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, kernel
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "nvidia-open";
|
||||
version = "${kernel.version}-${nvidia_x11.version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "NVIDIA";
|
||||
repo = "open-gpu-kernel-modules";
|
||||
rev = nvidia_x11.version;
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
makeFlags = kernel.makeFlags ++ [
|
||||
"SYSSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
|
||||
"SYSOUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
"MODLIB=$(out)/lib/modules/${kernel.modDirVersion}"
|
||||
];
|
||||
|
||||
installTargets = [ "modules_install" ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "NVIDIA Linux Open GPU Kernel Module";
|
||||
homepage = "https://github.com/NVIDIA/open-gpu-kernel-modules";
|
||||
license = with licenses; [ gpl2Plus mit ];
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ nickcao ];
|
||||
};
|
||||
}
|
|
@ -357,6 +357,10 @@ in {
|
|||
nvidia_x11_vulkan_beta = nvidiaPackages.vulkan_beta;
|
||||
nvidia_x11 = nvidiaPackages.stable;
|
||||
|
||||
# this is not a replacement for nvidia_x11
|
||||
# only the opensource kernel driver exposed for hydra to build
|
||||
nvidia_x11_beta_open = nvidiaPackages.beta.open;
|
||||
|
||||
openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
|
||||
|
||||
ply = callPackage ../os-specific/linux/ply { };
|
||||
|
|
Loading…
Reference in a new issue