uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
199
pkgs/os-specific/linux/nvidia-x11/builder.sh
Executable file
199
pkgs/os-specific/linux/nvidia-x11/builder.sh
Executable file
|
|
@ -0,0 +1,199 @@
|
|||
source $stdenv/setup
|
||||
|
||||
unpackManually() {
|
||||
skip=$(sed 's/^skip=//; t; d' $src)
|
||||
tail -n +$skip $src | xz -d | tar xvf -
|
||||
sourceRoot=.
|
||||
}
|
||||
|
||||
|
||||
unpackFile() {
|
||||
sh $src -x || unpackManually
|
||||
}
|
||||
|
||||
|
||||
buildPhase() {
|
||||
if [ -n "$bin" ]; then
|
||||
# Create the module.
|
||||
echo "Building linux driver against kernel: $kernel";
|
||||
cd kernel
|
||||
unset src # used by the nv makefile
|
||||
make $makeFlags -j $NIX_BUILD_CORES module
|
||||
|
||||
cd ..
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
installPhase() {
|
||||
# Install libGL and friends.
|
||||
|
||||
# since version 391, 32bit libraries are bundled in the 32/ sub-directory
|
||||
if [ "$i686bundled" = "1" ]; then
|
||||
mkdir -p "$lib32/lib"
|
||||
cp -prd 32/*.so.* "$lib32/lib/"
|
||||
if [ -d 32/tls ]; then
|
||||
cp -prd 32/tls "$lib32/lib/"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$out/lib"
|
||||
cp -prd *.so.* "$out/lib/"
|
||||
if [ -d tls ]; then
|
||||
cp -prd tls "$out/lib/"
|
||||
fi
|
||||
|
||||
# Install systemd power management executables
|
||||
if [ -e systemd/nvidia-sleep.sh ]; then
|
||||
mv systemd/nvidia-sleep.sh ./
|
||||
fi
|
||||
if [ -e nvidia-sleep.sh ]; then
|
||||
sed -E 's#(PATH=).*#\1"$PATH"#' nvidia-sleep.sh > nvidia-sleep.sh.fixed
|
||||
install -Dm755 nvidia-sleep.sh.fixed $out/bin/nvidia-sleep.sh
|
||||
fi
|
||||
|
||||
if [ -e systemd/system-sleep/nvidia ]; then
|
||||
mv systemd/system-sleep/nvidia ./
|
||||
fi
|
||||
if [ -e nvidia ]; then
|
||||
sed -E "s#/usr(/bin/nvidia-sleep.sh)#$out\\1#" nvidia > nvidia.fixed
|
||||
install -Dm755 nvidia.fixed $out/lib/systemd/system-sleep/nvidia
|
||||
fi
|
||||
|
||||
for i in $lib32 $out; do
|
||||
rm -f $i/lib/lib{glx,nvidia-wfb}.so.* # handled separately
|
||||
rm -f $i/lib/libnvidia-gtk* # built from source
|
||||
if [ "$useGLVND" = "1" ]; then
|
||||
# Pre-built libglvnd
|
||||
rm $i/lib/lib{GL,GLX,EGL,GLESv1_CM,GLESv2,OpenGL,GLdispatch}.so.*
|
||||
fi
|
||||
# Use ocl-icd instead
|
||||
rm -f $i/lib/libOpenCL.so*
|
||||
# Move VDPAU libraries to their place
|
||||
mkdir $i/lib/vdpau
|
||||
mv $i/lib/libvdpau* $i/lib/vdpau
|
||||
|
||||
# Install ICDs, make absolute paths.
|
||||
# Be careful not to modify any original files because this runs twice.
|
||||
|
||||
# OpenCL
|
||||
sed -E "s#(libnvidia-opencl)#$i/lib/\\1#" nvidia.icd > nvidia.icd.fixed
|
||||
install -Dm644 nvidia.icd.fixed $i/etc/OpenCL/vendors/nvidia.icd
|
||||
|
||||
# Vulkan
|
||||
if [ -e nvidia_icd.json.template ] || [ -e nvidia_icd.json ]; then
|
||||
if [ -e nvidia_icd.json.template ]; then
|
||||
# template patching for version < 435
|
||||
sed "s#__NV_VK_ICD__#$i/lib/libGLX_nvidia.so#" nvidia_icd.json.template > nvidia_icd.json.fixed
|
||||
else
|
||||
sed -E "s#(libGLX_nvidia)#$i/lib/\\1#" nvidia_icd.json > nvidia_icd.json.fixed
|
||||
fi
|
||||
|
||||
# nvidia currently only supports x86_64 and i686
|
||||
if [ "$i" == "$lib32" ]; then
|
||||
install -Dm644 nvidia_icd.json.fixed $i/share/vulkan/icd.d/nvidia_icd.i686.json
|
||||
else
|
||||
install -Dm644 nvidia_icd.json.fixed $i/share/vulkan/icd.d/nvidia_icd.x86_64.json
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e nvidia_layers.json ]; then
|
||||
sed -E "s#(libGLX_nvidia)#$i/lib/\\1#" nvidia_layers.json > nvidia_layers.json.fixed
|
||||
install -Dm644 nvidia_layers.json.fixed $i/share/vulkan/implicit_layer.d/nvidia_layers.json
|
||||
fi
|
||||
|
||||
# EGL
|
||||
if [ "$useGLVND" = "1" ]; then
|
||||
sed -E "s#(libEGL_nvidia)#$i/lib/\\1#" 10_nvidia.json > 10_nvidia.json.fixed
|
||||
sed -E "s#(libnvidia-egl-wayland)#$i/lib/\\1#" 10_nvidia_wayland.json > 10_nvidia_wayland.json.fixed
|
||||
|
||||
install -Dm644 10_nvidia.json.fixed $i/share/glvnd/egl_vendor.d/10_nvidia.json
|
||||
install -Dm644 10_nvidia_wayland.json.fixed $i/share/egl/egl_external_platform.d/10_nvidia_wayland.json
|
||||
|
||||
if [[ -f "15_nvidia_gbm.json" ]]; then
|
||||
sed -E "s#(libnvidia-egl-gbm)#$i/lib/\\1#" 15_nvidia_gbm.json > 15_nvidia_gbm.json.fixed
|
||||
install -Dm644 15_nvidia_gbm.json.fixed $i/share/egl/egl_external_platform.d/15_nvidia_gbm.json
|
||||
|
||||
mkdir -p $i/lib/gbm
|
||||
ln -s $i/lib/libnvidia-allocator.so $i/lib/gbm/nvidia-drm_gbm.so
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ -n "$bin" ]; then
|
||||
# Install the X drivers.
|
||||
mkdir -p $bin/lib/xorg/modules
|
||||
if [ -f libnvidia-wfb.so ]; then
|
||||
cp -p libnvidia-wfb.* $bin/lib/xorg/modules/
|
||||
fi
|
||||
mkdir -p $bin/lib/xorg/modules/drivers
|
||||
cp -p nvidia_drv.so $bin/lib/xorg/modules/drivers
|
||||
mkdir -p $bin/lib/xorg/modules/extensions
|
||||
cp -p libglx*.so* $bin/lib/xorg/modules/extensions
|
||||
|
||||
# Install the kernel module.
|
||||
mkdir -p $bin/lib/modules/$kernelVersion/misc
|
||||
for i in $(find ./kernel -name '*.ko'); do
|
||||
nuke-refs $i
|
||||
cp $i $bin/lib/modules/$kernelVersion/misc/
|
||||
done
|
||||
|
||||
# Install application profiles.
|
||||
if [ "$useProfiles" = "1" ]; then
|
||||
mkdir -p $bin/share/nvidia
|
||||
cp nvidia-application-profiles-*-rc $bin/share/nvidia/nvidia-application-profiles-rc
|
||||
cp nvidia-application-profiles-*-key-documentation $bin/share/nvidia/nvidia-application-profiles-key-documentation
|
||||
fi
|
||||
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
|
||||
# I'm lazy to differentiate needed libs per-library, as the closure is the same.
|
||||
# Unfortunately --shrink-rpath would strip too much.
|
||||
if [[ -n $lib32 && $libname == "$lib32/lib/"* ]]; then
|
||||
patchelf --set-rpath "$lib32/lib:$libPath32" "$libname"
|
||||
else
|
||||
patchelf --set-rpath "$out/lib:$libPath" "$libname"
|
||||
fi
|
||||
|
||||
libname_short=`echo -n "$libname" | sed 's/so\..*/so/'`
|
||||
|
||||
if [[ "$libname" != "$libname_short" ]]; then
|
||||
ln -srnf "$libname" "$libname_short"
|
||||
fi
|
||||
|
||||
if [[ $libname_short =~ libEGL.so || $libname_short =~ libEGL_nvidia.so || $libname_short =~ libGLX.so || $libname_short =~ libGLX_nvidia.so ]]; then
|
||||
major=0
|
||||
else
|
||||
major=1
|
||||
fi
|
||||
|
||||
if [[ "$libname" != "$libname_short.$major" ]]; then
|
||||
ln -srnf "$libname" "$libname_short.$major"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$bin" ]; then
|
||||
# Install /share files.
|
||||
mkdir -p $bin/share/man/man1
|
||||
cp -p *.1.gz $bin/share/man/man1
|
||||
rm -f $bin/share/man/man1/{nvidia-xconfig,nvidia-settings,nvidia-persistenced}.1.gz
|
||||
|
||||
# Install the programs.
|
||||
for i in nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-smi nvidia-debugdump; do
|
||||
if [ -e "$i" ]; then
|
||||
install -Dm755 $i $bin/bin/$i
|
||||
# unmodified binary backup for mounting in containers
|
||||
install -Dm755 $i $bin/origBin/$i
|
||||
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath $out/lib:$libPath $bin/bin/$i
|
||||
fi
|
||||
done
|
||||
# FIXME: needs PATH and other fixes
|
||||
# install -Dm755 nvidia-bug-report.sh $bin/bin/nvidia-bug-report.sh
|
||||
fi
|
||||
}
|
||||
|
||||
genericBuild
|
||||
83
pkgs/os-specific/linux/nvidia-x11/default.nix
Normal file
83
pkgs/os-specific/linux/nvidia-x11/default.nix
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{ lib, callPackage, fetchpatch, fetchurl, stdenv, pkgsi686Linux }:
|
||||
|
||||
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 {
|
||||
lib32 = (pkgsi686Linux.callPackage imported {
|
||||
libsOnly = true;
|
||||
kernel = null;
|
||||
}).out;
|
||||
};
|
||||
|
||||
kernel = callPackage # a hacky way of extracting parameters from callPackage
|
||||
({ kernel, libsOnly ? false }: if libsOnly then { } else kernel) { };
|
||||
in
|
||||
rec {
|
||||
# Policy: use the highest stable version as the default (on our master).
|
||||
stable = if stdenv.hostPlatform.system == "x86_64-linux"
|
||||
then generic {
|
||||
version = "515.48.07";
|
||||
sha256_64bit = "sha256-4odkzFsTwy52NwUT2ur8BcKJt37gURVSRQ8aAOMa4eM=";
|
||||
settingsSha256 = "sha256-XwdMsAAu5132x2ZHqjtFvcBJk6Dao7I86UksxrOkknU=";
|
||||
persistencedSha256 = "sha256-BTfYNDJKe4tOvV71/1JJSPltJua0Mx/RvDcWT5ccRRY=";
|
||||
}
|
||||
else legacy_390;
|
||||
|
||||
# see https://www.nvidia.com/en-us/drivers/unix/ "Production branch"
|
||||
production = stable;
|
||||
|
||||
beta = generic {
|
||||
version = "515.43.04";
|
||||
sha256_64bit = "sha256-PodaTTUOSyMW8rtdtabIkSLskgzAymQyfToNlwxPPcc=";
|
||||
settingsSha256 = "sha256-j47LtP6FNTPfiXFh9KwXX8vZOQzlytA30ZfW9N5F2PY=";
|
||||
persistencedSha256 = "sha256-hULBy0wnVpLH8I0L6O9/HfgvJURtE2whpXOgN/vb3Wo=";
|
||||
};
|
||||
|
||||
# Vulkan developer beta driver
|
||||
# See here for more information: https://developer.nvidia.com/vulkan-driver
|
||||
vulkan_beta = generic rec {
|
||||
version = "470.62.13";
|
||||
persistencedVersion = "470.86";
|
||||
settingsVersion = "470.86";
|
||||
sha256_64bit = "sha256-itBFNPMy+Nn0g8V8qdkRb+ELHj57GRso1lXhPHUxKVI=";
|
||||
settingsSha256 = "sha256-fq6RlD6g3uylvvTjE4MmaQwxPJYU0u6IMfpPVzks0tI=";
|
||||
persistencedSha256 = "sha256-eHvauvh8Wd+b8DK6B3ZWNjoWGztupWrR8iog9ok58io=";
|
||||
url = "https://developer.nvidia.com/vulkan-beta-${lib.concatStrings (lib.splitString "." version)}-linux";
|
||||
};
|
||||
|
||||
# Update note:
|
||||
# If you add a legacy driver here, also update `top-level/linux-kernels.nix`,
|
||||
# adding to the `nvidia_x11_legacy*` entries.
|
||||
|
||||
# Last one supporting Kepler architecture
|
||||
legacy_470 = generic {
|
||||
version = "470.129.06";
|
||||
sha256_64bit = "sha256-QQkQtwBuFzBjMnaDKfS1PW+ekcxVXCiJkXWOKo8IqZg=";
|
||||
settingsSha256 = "sha256-vUS4O/c4IrbC8offzUFGLlMdP/Tlz1GwQIV2geRfj/o=";
|
||||
persistencedSha256 = "sha256-jCcYUsbhQ77IOQquXqbTZfh1N0IvKQOWrIMU9rEwSW0=";
|
||||
};
|
||||
|
||||
# Last one supporting x86
|
||||
legacy_390 = generic {
|
||||
version = "390.151";
|
||||
sha256_32bit = "sha256-lOOZtFllnBKxNE6Mj09e7h7VkV/0WfyLuDHJ4dRGd9s=";
|
||||
sha256_64bit = "sha256-UibkhCBEz/2Qlt6tr2iTTBM9p04FuAzNISNlhLOvsfw=";
|
||||
settingsSha256 = "sha256-teXQa0pQctQl1dvddVJtI7U/vVuMu6ER1Xd99Jprpvw=";
|
||||
persistencedSha256 = "sha256-FxiTXYABplKFcBXr4orhYWiJq4zVePpplMbg2kvEuXk=";
|
||||
};
|
||||
|
||||
legacy_340 = generic {
|
||||
version = "340.108";
|
||||
sha256_32bit = "1jkwa1phf0x4sgw8pvr9d6krmmr3wkgwyygrxhdazwyr2bbalci0";
|
||||
sha256_64bit = "06xp6c0sa7v1b82gf0pq0i5p0vdhmm3v964v0ypw36y0nzqx8wf6";
|
||||
settingsSha256 = "0zm29jcf0mp1nykcravnzb5isypm8l8mg2gpsvwxipb7nk1ivy34";
|
||||
persistencedSha256 = "1ax4xn3nmxg1y6immq933cqzw6cj04x93saiasdc0kjlv0pvvnkn";
|
||||
useGLVND = false;
|
||||
|
||||
broken = kernel.kernelAtLeast "5.5";
|
||||
patches = [ ./vm_operations_struct-fault.patch ];
|
||||
};
|
||||
}
|
||||
124
pkgs/os-specific/linux/nvidia-x11/generic.nix
Normal file
124
pkgs/os-specific/linux/nvidia-x11/generic.nix
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
{ version
|
||||
, url ? null
|
||||
, sha256_32bit ? null
|
||||
, sha256_64bit
|
||||
, settingsSha256
|
||||
, settingsVersion ? version
|
||||
, persistencedSha256
|
||||
, persistencedVersion ? version
|
||||
, useGLVND ? true
|
||||
, useProfiles ? true
|
||||
, preferGtk2 ? false
|
||||
, settings32Bit ? false
|
||||
|
||||
, prePatch ? ""
|
||||
, patches ? []
|
||||
, broken ? false
|
||||
}@args:
|
||||
|
||||
{ lib, stdenv, callPackage, pkgs, pkgsi686Linux, fetchurl
|
||||
, kernel ? null, perl, nukeReferences, which
|
||||
, # Whether to build the libraries only (i.e. not the kernel module or
|
||||
# nvidia-settings). Used to support 32-bit binaries on 64-bit
|
||||
# Linux.
|
||||
libsOnly ? false
|
||||
, # don't include the bundled 32-bit libraries on 64-bit platforms,
|
||||
# even if it’s in downloaded binary
|
||||
disable32Bit ? false
|
||||
# 32 bit libs only version of this package
|
||||
, lib32 ? 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}";
|
||||
pkgSuffix = optionalString (versionOlder version "304") "-pkg0";
|
||||
i686bundled = versionAtLeast version "391" && !disable32Bit;
|
||||
|
||||
libPathFor = pkgs: lib.makeLibraryPath (with pkgs; [
|
||||
libdrm xorg.libXext xorg.libX11
|
||||
xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc
|
||||
wayland mesa libGL
|
||||
]);
|
||||
|
||||
self = stdenv.mkDerivation {
|
||||
name = "nvidia-x11-${version}${nameSuffix}";
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = args.url or "https://us.download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}${pkgSuffix}.run";
|
||||
sha256 = sha256_64bit;
|
||||
}
|
||||
else if stdenv.hostPlatform.system == "i686-linux" then
|
||||
fetchurl {
|
||||
url = args.url or "https://download.nvidia.com/XFree86/Linux-x86/${version}/NVIDIA-Linux-x86-${version}${pkgSuffix}.run";
|
||||
sha256 = sha256_32bit;
|
||||
}
|
||||
else throw "nvidia-x11 does not support platform ${stdenv.hostPlatform.system}";
|
||||
|
||||
patches = if libsOnly then null else patches;
|
||||
inherit prePatch;
|
||||
inherit version useGLVND useProfiles;
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
inherit i686bundled;
|
||||
|
||||
outputs = [ "out" ]
|
||||
++ optional i686bundled "lib32"
|
||||
++ optional (!libsOnly) "bin";
|
||||
outputDev = if libsOnly then null else "bin";
|
||||
|
||||
kernel = if libsOnly then null else kernel.dev;
|
||||
kernelVersion = if libsOnly then null else kernel.modDirVersion;
|
||||
|
||||
makeFlags = optionals (!libsOnly) (kernel.makeFlags ++ [
|
||||
"IGNORE_PREEMPT_RT_PRESENCE=1"
|
||||
"NV_BUILD_SUPPORTS_HMM=1"
|
||||
"SYSSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
|
||||
"SYSOUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||
]);
|
||||
|
||||
hardeningDisable = [ "pic" "format" ];
|
||||
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
||||
libPath = libPathFor pkgs;
|
||||
libPath32 = optionalString i686bundled (libPathFor pkgsi686Linux);
|
||||
|
||||
buildInputs = [ which ];
|
||||
nativeBuildInputs = [ perl nukeReferences ]
|
||||
++ optionals (!libsOnly) kernel.moduleBuildDependencies;
|
||||
|
||||
disallowedReferences = optional (!libsOnly) [ kernel.dev ];
|
||||
|
||||
passthru = {
|
||||
settings = (if settings32Bit then pkgsi686Linux.callPackage else callPackage) (import ./settings.nix self settingsSha256) {
|
||||
withGtk2 = preferGtk2;
|
||||
withGtk3 = !preferGtk2;
|
||||
};
|
||||
persistenced = mapNullable (hash: callPackage (import ./persistenced.nix self hash) { }) persistencedSha256;
|
||||
inherit persistencedVersion settingsVersion;
|
||||
} // optionalAttrs (!i686bundled) {
|
||||
inherit lib32;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nvidia.com/object/unix.html";
|
||||
description = "X.org driver and kernel module for NVIDIA graphics cards";
|
||||
license = licenses.unfreeRedistributable;
|
||||
platforms = [ "x86_64-linux" ] ++ optionals (!i686bundled) [ "i686-linux" ];
|
||||
maintainers = with maintainers; [ jonringer ];
|
||||
priority = 4; # resolves collision with xorg-server's "lib/xorg/modules/extensions/libglx.so"
|
||||
inherit broken;
|
||||
};
|
||||
};
|
||||
|
||||
in self
|
||||
48
pkgs/os-specific/linux/nvidia-x11/persistenced.nix
Normal file
48
pkgs/os-specific/linux/nvidia-x11/persistenced.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
nvidia_x11: sha256:
|
||||
|
||||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, m4
|
||||
, libtirpc
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nvidia-persistenced";
|
||||
version = nvidia_x11.persistencedVersion;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "NVIDIA";
|
||||
repo = "nvidia-persistenced";
|
||||
rev = nvidia_x11.persistencedVersion;
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ m4 ];
|
||||
buildInputs = [ libtirpc ];
|
||||
|
||||
inherit (nvidia_x11) makeFlags;
|
||||
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
|
||||
postFixup = ''
|
||||
# Save a copy of persistenced for mounting in containers
|
||||
mkdir $out/origBin
|
||||
cp $out/{bin,origBin}/nvidia-persistenced
|
||||
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 $out/origBin/nvidia-persistenced
|
||||
|
||||
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/nvidia-persistenced):${nvidia_x11}/lib" \
|
||||
$out/bin/nvidia-persistenced
|
||||
'';
|
||||
|
||||
NIX_CFLAGS_COMPILE = [ "-I${libtirpc.dev}/include/tirpc" ];
|
||||
NIX_LDFLAGS = [ "-ltirpc" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nvidia.com/object/unix.html";
|
||||
description = "Settings application for NVIDIA graphics cards";
|
||||
license = licenses.unfreeRedistributable;
|
||||
platforms = nvidia_x11.meta.platforms;
|
||||
maintainers = with maintainers; [ abbradar ];
|
||||
};
|
||||
}
|
||||
107
pkgs/os-specific/linux/nvidia-x11/settings.nix
Normal file
107
pkgs/os-specific/linux/nvidia-x11/settings.nix
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
nvidia_x11: sha256:
|
||||
|
||||
{ stdenv, lib, fetchFromGitHub, pkg-config, m4, jansson, gtk2, dbus, gtk3, libXv, libXrandr, libXext, libXxf86vm, libvdpau
|
||||
, librsvg, wrapGAppsHook
|
||||
, withGtk2 ? false, withGtk3 ? true
|
||||
}:
|
||||
|
||||
let
|
||||
src = fetchFromGitHub {
|
||||
owner = "NVIDIA";
|
||||
repo = "nvidia-settings";
|
||||
rev = nvidia_x11.settingsVersion;
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
libXNVCtrl = stdenv.mkDerivation {
|
||||
pname = "libXNVCtrl";
|
||||
version = nvidia_x11.settingsVersion;
|
||||
inherit src;
|
||||
|
||||
buildInputs = [ libXrandr libXext ];
|
||||
|
||||
preBuild = ''
|
||||
cd src/libXNVCtrl
|
||||
'';
|
||||
|
||||
makeFlags = nvidia_x11.makeFlags ++ [
|
||||
"OUTPUTDIR=." # src/libXNVCtrl
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib
|
||||
mkdir -p $out/include/NVCtrl
|
||||
|
||||
cp libXNVCtrl.a $out/lib
|
||||
cp NVCtrl.h $out/include/NVCtrl
|
||||
cp NVCtrlLib.h $out/include/NVCtrl
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "nvidia-settings";
|
||||
version = nvidia_x11.settingsVersion;
|
||||
inherit src;
|
||||
|
||||
nativeBuildInputs = [ pkg-config m4 ];
|
||||
|
||||
buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 gtk2 dbus ]
|
||||
++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
makeFlags = nvidia_x11.makeFlags ++ [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
|
||||
postPatch = lib.optionalString nvidia_x11.useProfiles ''
|
||||
sed -i 's,/usr/share/nvidia/,${nvidia_x11.bin}/share/nvidia/,g' src/gtk+-2.x/ctkappprofile.c
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
if [ -e src/libXNVCtrl/libXNVCtrl.a ]; then
|
||||
( cd src/libXNVCtrl
|
||||
make $makeFlags
|
||||
)
|
||||
fi
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
${lib.optionalString (!withGtk2) ''
|
||||
rm -f $out/lib/libnvidia-gtk2.so.*
|
||||
''}
|
||||
${lib.optionalString (!withGtk3) ''
|
||||
rm -f $out/lib/libnvidia-gtk3.so.*
|
||||
''}
|
||||
|
||||
# Install the desktop file and icon.
|
||||
# The template has substitution variables intended to be replaced resulting
|
||||
# in absolute paths. Because absolute paths break after the desktop file is
|
||||
# copied by a desktop environment, make Exec and Icon be just a name.
|
||||
sed -i doc/nvidia-settings.desktop \
|
||||
-e "s|^Exec=.*$|Exec=nvidia-settings|" \
|
||||
-e "s|^Icon=.*$|Icon=nvidia-settings|" \
|
||||
-e "s|__NVIDIA_SETTINGS_DESKTOP_CATEGORIES__|Settings|g"
|
||||
install doc/nvidia-settings.desktop -D -t $out/share/applications/
|
||||
install doc/nvidia-settings.png -D -t $out/share/icons/hicolor/128x128/apps/
|
||||
'';
|
||||
|
||||
binaryName = if withGtk3 then ".nvidia-settings-wrapped" else "nvidia-settings";
|
||||
|
||||
postFixup = ''
|
||||
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/$binaryName):$out/lib:${libXv}/lib" \
|
||||
$out/bin/$binaryName
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit libXNVCtrl;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nvidia.com/object/unix.html";
|
||||
description = "Settings application for NVIDIA graphics cards";
|
||||
license = licenses.unfreeRedistributable;
|
||||
platforms = nvidia_x11.meta.platforms;
|
||||
maintainers = with maintainers; [ abbradar ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
https://devtalk.nvidia.com/default/topic/1025051/fully-working-patches-2-of-them-for-nvidia-driver-340-104-compiler-installer-file-and-linux-kernels-4-13-amp-4-14/?offset=5
|
||||
--- a/kernel/uvm/nvidia_uvm_lite.c
|
||||
+++ b/kernel/uvm/nvidia_uvm_lite.c
|
||||
@@ -818,8 +818,15 @@ done:
|
||||
}
|
||||
|
||||
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
int _fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
+#else
|
||||
+int _fault(struct vm_fault *vmf)
|
||||
+#endif
|
||||
{
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
+ struct vm_area_struct *vma = vmf->vma;
|
||||
+#endif
|
||||
#if defined(NV_VM_FAULT_HAS_ADDRESS)
|
||||
unsigned long vaddr = vmf->address;
|
||||
#else
|
||||
@@ -866,7 +873,11 @@ static struct vm_operations_struct uvmlite_vma_ops =
|
||||
// it's dealing with anonymous mapping (see handle_pte_fault).
|
||||
//
|
||||
#if defined(NV_VM_OPERATIONS_STRUCT_HAS_FAULT)
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
int _sigbus_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
|
||||
+#else
|
||||
+int _sigbus_fault(struct vm_fault *vmf)
|
||||
+#endif
|
||||
{
|
||||
vmf->page = NULL;
|
||||
return VM_FAULT_SIGBUS;
|
||||
Loading…
Add table
Add a link
Reference in a new issue