nvidia_x11: init opensource kernel driver

main
Nick Cao 2 years ago
parent f1142c5a20
commit 94f5bd2051
No known key found for this signature in database
GPG Key ID: 068A56CEF48FA2C1
  1. 5
      nixos/modules/hardware/video/nvidia.nix
  2. 5
      pkgs/os-specific/linux/nvidia-x11/builder.sh
  3. 6
      pkgs/os-specific/linux/nvidia-x11/default.nix
  4. 8
      pkgs/os-specific/linux/nvidia-x11/generic.nix
  5. 37
      pkgs/os-specific/linux/nvidia-x11/open.nix
  6. 5
      pkgs/top-level/linux-kernels.nix

@ -231,6 +231,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:

@ -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=";
};

@ -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;

@ -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 ];
};
}

@ -356,6 +356,11 @@ 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_open = nvidiaPackages.stable.open;
nvidia_x11_beta_open = nvidiaPackages.beta.open;
openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
ply = callPackage ../os-specific/linux/ply { };

Loading…
Cancel
Save