1{ stdenv
2, lib
3, fetchFromGitHub
4, kernel
5, nvidia_x11
6, hash
7, broken ? false
8}:
9
10stdenv.mkDerivation ({
11 pname = "nvidia-open";
12 version = "${kernel.version}-${nvidia_x11.version}";
13
14 src = fetchFromGitHub {
15 owner = "NVIDIA";
16 repo = "open-gpu-kernel-modules";
17 rev = nvidia_x11.version;
18 inherit hash;
19 };
20
21 nativeBuildInputs = kernel.moduleBuildDependencies;
22
23 makeFlags = kernel.makeFlags ++ [
24 "SYSSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
25 "SYSOUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
26 "MODLIB=$(out)/lib/modules/${kernel.modDirVersion}"
27 {
28 aarch64-linux = "TARGET_ARCH=aarch64";
29 x86_64-linux = "TARGET_ARCH=x86_64";
30 }.${stdenv.hostPlatform.system}
31 ];
32
33 installTargets = [ "modules_install" ];
34 enableParallelBuilding = true;
35
36 meta = with lib; {
37 description = "NVIDIA Linux Open GPU Kernel Module";
38 homepage = "https://github.com/NVIDIA/open-gpu-kernel-modules";
39 license = with licenses; [ gpl2Plus mit ];
40 platforms = [ "x86_64-linux" "aarch64-linux" ];
41 maintainers = with maintainers; [ nickcao ];
42 inherit broken;
43 };
44} // lib.optionalAttrs stdenv.hostPlatform.isAarch64 {
45 env.NIX_CFLAGS_COMPILE = "-fno-stack-protector";
46})