2022-06-26 10:26:21 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, kernel
|
2022-08-21 13:32:41 +00:00
|
|
|
, nvidia_x11
|
|
|
|
, hash
|
|
|
|
, broken ? false
|
2022-06-26 10:26:21 +00:00
|
|
|
}:
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
stdenv.mkDerivation ({
|
2022-06-26 10:26:21 +00:00
|
|
|
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}"
|
2023-04-29 16:46:19 +00:00
|
|
|
{
|
|
|
|
aarch64-linux = "TARGET_ARCH=aarch64";
|
|
|
|
x86_64-linux = "TARGET_ARCH=x86_64";
|
|
|
|
}.${stdenv.hostPlatform.system}
|
2022-06-26 10:26:21 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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 ];
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2022-06-26 10:26:21 +00:00
|
|
|
maintainers = with maintainers; [ nickcao ];
|
2022-08-21 13:32:41 +00:00
|
|
|
inherit broken;
|
2022-06-26 10:26:21 +00:00
|
|
|
};
|
2023-04-29 16:46:19 +00:00
|
|
|
} // lib.optionalAttrs stdenv.hostPlatform.isAarch64 {
|
|
|
|
env.NIX_CFLAGS_COMPILE = "-fno-stack-protector";
|
|
|
|
})
|