2017-01-29 22:29:39 +01:00
|
|
|
nvidia_x11: sha256:
|
|
|
|
|
2019-04-23 21:46:45 +02:00
|
|
|
{ stdenv, lib, fetchFromGitHub, pkgconfig, m4, jansson, gtk2, dbus, gtk3, libXv, libXrandr, libXext, libXxf86vm, libvdpau
|
2017-02-19 17:44:53 +01:00
|
|
|
, librsvg, wrapGAppsHook
|
2017-01-29 22:29:39 +01:00
|
|
|
, withGtk2 ? false, withGtk3 ? true
|
|
|
|
}:
|
|
|
|
|
2017-05-23 23:56:00 +02:00
|
|
|
let
|
2019-04-23 21:46:45 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NVIDIA";
|
|
|
|
repo = "nvidia-settings";
|
|
|
|
rev = nvidia_x11.version;
|
2017-01-29 22:29:39 +01:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2017-05-23 23:56:00 +02:00
|
|
|
libXNVCtrl = stdenv.mkDerivation {
|
2019-04-23 21:46:45 +02:00
|
|
|
pname = "libXNVCtrl";
|
2017-05-23 23:56:00 +02:00
|
|
|
inherit (nvidia_x11) version;
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
buildInputs = [ libXrandr libXext ];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cd 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 rec {
|
2019-04-23 21:46:45 +02:00
|
|
|
pname = "nvidia-settings";
|
2017-05-23 23:56:00 +02:00
|
|
|
inherit (nvidia_x11) version;
|
|
|
|
inherit src;
|
|
|
|
|
2017-01-29 22:29:39 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig m4 ];
|
|
|
|
|
2018-03-25 23:33:23 +02:00
|
|
|
buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 gtk2 dbus ]
|
2017-02-19 17:44:53 +01:00
|
|
|
++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
|
2017-01-29 22:29:39 +01:00
|
|
|
|
2017-02-19 09:53:23 +01:00
|
|
|
makeFlags = [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
|
2017-01-29 22:29:39 +01:00
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2017-02-11 15:11:18 +01: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 22:29:39 +01: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 17:44:53 +01:00
|
|
|
binaryName = if withGtk3 then ".nvidia-settings-wrapped" else "nvidia-settings";
|
|
|
|
|
2017-01-29 22:29:39 +01:00
|
|
|
postFixup = ''
|
2017-12-17 16:34:32 +01:00
|
|
|
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/$binaryName):$out/lib:${libXv}/lib" \
|
2017-02-19 17:44:53 +01:00
|
|
|
$out/bin/$binaryName
|
2017-01-29 22:29:39 +01:00
|
|
|
'';
|
|
|
|
|
2017-05-23 23:56:00 +02:00
|
|
|
passthru = {
|
|
|
|
inherit libXNVCtrl;
|
|
|
|
};
|
|
|
|
|
2017-01-29 22:29:39 +01:00
|
|
|
meta = with stdenv.lib; {
|
2019-04-15 01:25:45 +02:00
|
|
|
homepage = https://www.nvidia.com/object/unix.html;
|
2017-01-29 22:29:39 +01:00
|
|
|
description = "Settings application for NVIDIA graphics cards";
|
|
|
|
license = licenses.unfreeRedistributable;
|
2018-03-27 15:40:15 +02:00
|
|
|
platforms = nvidia_x11.meta.platforms;
|
2017-01-29 22:29:39 +01:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|