2017-01-29 21:29:39 +00:00
|
|
|
nvidia_x11: sha256:
|
|
|
|
|
2017-05-12 08:29:17 +00:00
|
|
|
{ stdenv, lib, fetchurl, pkgconfig, m4, jansson, gtk2, dbus, gtk3, libXv, libXrandr, libvdpau
|
2017-02-19 16:44:53 +00:00
|
|
|
, librsvg, wrapGAppsHook
|
2017-01-29 21:29:39 +00:00
|
|
|
, withGtk2 ? false, withGtk3 ? true
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "nvidia-settings-${nvidia_x11.version}";
|
|
|
|
inherit (nvidia_x11) version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2017-04-29 21:19:04 +00:00
|
|
|
url = "https://download.nvidia.com/XFree86/nvidia-settings/${name}.tar.bz2";
|
2017-01-29 21:29:39 +00:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig m4 ];
|
|
|
|
|
2017-05-12 08:29:17 +00:00
|
|
|
buildInputs = [ jansson libXv libXrandr libvdpau nvidia_x11 gtk2 dbus ]
|
2017-02-19 16:44:53 +00:00
|
|
|
++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2017-02-19 08:53:23 +00:00
|
|
|
NIX_LDFLAGS = [ "-lvdpau" "-lXrandr" "-lXv" "-lnvidia-ml" ];
|
|
|
|
|
|
|
|
makeFlags = [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
|
2017-01-29 21:29:39 +00:00
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2017-02-11 14:11:18 +00:00
|
|
|
postPatch = lib.optionalString nvidia_x11.useProfiles ''
|
|
|
|
sed -i 's,/usr/share/nvidia/,${nvidia_x11.bin}/share/nvidia/,g' src/gtk+-2.x/ctkappprofile.c
|
|
|
|
'';
|
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
preBuild = ''
|
|
|
|
if [ -e src/libXNVCtrl/libXNVCtrl.a ]; then
|
|
|
|
( cd src/libXNVCtrl
|
|
|
|
make
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
${lib.optionalString (!withGtk2) ''
|
|
|
|
rm -f $out/lib/libnvidia-gtk2.so.*
|
|
|
|
''}
|
|
|
|
${lib.optionalString (!withGtk3) ''
|
|
|
|
rm -f $out/lib/libnvidia-gtk3.so.*
|
|
|
|
''}
|
|
|
|
'';
|
|
|
|
|
2017-02-19 16:44:53 +00:00
|
|
|
binaryName = if withGtk3 then ".nvidia-settings-wrapped" else "nvidia-settings";
|
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
postFixup = ''
|
2017-02-19 16:44:53 +00:00
|
|
|
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/$binaryName):$out/lib" \
|
|
|
|
$out/bin/$binaryName
|
2017-01-29 21:29:39 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "http://www.nvidia.com/object/unix.html";
|
|
|
|
description = "Settings application for NVIDIA graphics cards";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|