2017-01-29 21:29:39 +00:00
|
|
|
nvidia_x11: sha256:
|
|
|
|
|
2023-08-14 17:00:07 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, pkg-config
|
|
|
|
, m4
|
|
|
|
, jansson
|
|
|
|
, gtk2
|
|
|
|
, dbus
|
|
|
|
, gtk3
|
|
|
|
, libXv
|
|
|
|
, libXrandr
|
|
|
|
, libXext
|
|
|
|
, libXxf86vm
|
|
|
|
, libvdpau
|
|
|
|
, librsvg
|
|
|
|
, wrapGAppsHook
|
|
|
|
, addOpenGLRunpath
|
|
|
|
, withGtk2 ? false
|
|
|
|
, withGtk3 ? true
|
2017-01-29 21:29:39 +00:00
|
|
|
}:
|
|
|
|
|
2017-05-23 21:56:00 +00:00
|
|
|
let
|
2019-04-23 19:46:45 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "NVIDIA";
|
|
|
|
repo = "nvidia-settings";
|
2020-09-24 14:53:05 +00:00
|
|
|
rev = nvidia_x11.settingsVersion;
|
2017-01-29 21:29:39 +00:00
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
2017-05-23 21:56:00 +00:00
|
|
|
libXNVCtrl = stdenv.mkDerivation {
|
2019-04-23 19:46:45 +00:00
|
|
|
pname = "libXNVCtrl";
|
2020-09-24 14:53:05 +00:00
|
|
|
version = nvidia_x11.settingsVersion;
|
2017-05-23 21:56:00 +00:00
|
|
|
inherit src;
|
|
|
|
|
|
|
|
buildInputs = [ libXrandr libXext ];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
cd src/libXNVCtrl
|
|
|
|
'';
|
|
|
|
|
2023-02-03 12:56:21 +00:00
|
|
|
makeFlags = [
|
2019-07-02 18:36:21 +00:00
|
|
|
"OUTPUTDIR=." # src/libXNVCtrl
|
|
|
|
];
|
|
|
|
|
2017-05-23 21:56:00 +00:00
|
|
|
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
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-04-23 19:46:45 +00:00
|
|
|
pname = "nvidia-settings";
|
2020-09-24 14:53:05 +00:00
|
|
|
version = nvidia_x11.settingsVersion;
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2022-08-01 23:14:18 +00:00
|
|
|
inherit src;
|
2017-01-29 21:29:39 +00:00
|
|
|
|
2022-08-01 23:14:18 +00:00
|
|
|
patches = lib.optional (lib.versionOlder nvidia_x11.settingsVersion "440")
|
|
|
|
(fetchpatch {
|
|
|
|
# fixes "multiple definition of `VDPAUDeviceFunctions'" linking errors
|
|
|
|
url = "https://github.com/NVIDIA/nvidia-settings/commit/a7c1f5fce6303a643fadff7d85d59934bd0cf6b6.patch";
|
|
|
|
hash = "sha256-ZwF3dRTYt/hO8ELg9weoz1U/XcU93qiJL2d1aq1Jlak=";
|
2023-08-09 11:33:19 +00:00
|
|
|
})
|
2023-10-31 16:22:53 +00:00
|
|
|
++ lib.optional
|
|
|
|
((lib.versionAtLeast nvidia_x11.settingsVersion "515.43.04")
|
|
|
|
&& (lib.versionOlder nvidia_x11.settingsVersion "545.29"))
|
2023-08-09 11:33:19 +00:00
|
|
|
(fetchpatch {
|
|
|
|
# fix wayland support for compositors that use wl_output version 4
|
|
|
|
url = "https://github.com/NVIDIA/nvidia-settings/pull/99/commits/2e0575197e2b3247deafd2a48f45afc038939a06.patch";
|
|
|
|
hash = "sha256-wKuO5CUTUuwYvsP46Pz+6fI0yxLNpZv8qlbL0TFkEFE=";
|
2022-08-01 23:14:18 +00:00
|
|
|
});
|
2017-01-29 21:29:39 +00:00
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2022-08-01 23:14:18 +00:00
|
|
|
enableParallelBuilding = true;
|
2023-02-03 12:56:21 +00:00
|
|
|
makeFlags = [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
|
2022-08-01 23:14:18 +00:00
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
preBuild = ''
|
|
|
|
if [ -e src/libXNVCtrl/libXNVCtrl.a ]; then
|
|
|
|
( cd src/libXNVCtrl
|
2021-08-30 23:32:32 +00:00
|
|
|
make $makeFlags
|
2017-01-29 21:29:39 +00:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2023-08-14 17:00:07 +00:00
|
|
|
nativeBuildInputs = [ pkg-config m4 addOpenGLRunpath ];
|
2022-08-01 23:14:18 +00:00
|
|
|
|
|
|
|
buildInputs = [ jansson libXv libXrandr libXext libXxf86vm libvdpau nvidia_x11 gtk2 dbus ]
|
2023-08-14 17:00:07 +00:00
|
|
|
++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
|
2022-08-01 23:14:18 +00:00
|
|
|
|
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2017-01-29 21:29:39 +00:00
|
|
|
postInstall = ''
|
|
|
|
${lib.optionalString (!withGtk2) ''
|
|
|
|
rm -f $out/lib/libnvidia-gtk2.so.*
|
|
|
|
''}
|
|
|
|
${lib.optionalString (!withGtk3) ''
|
|
|
|
rm -f $out/lib/libnvidia-gtk3.so.*
|
|
|
|
''}
|
2019-06-27 11:02:53 +00:00
|
|
|
|
|
|
|
# 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/
|
2017-01-29 21:29:39 +00:00
|
|
|
'';
|
|
|
|
|
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-12-17 15:34:32 +00:00
|
|
|
patchelf --set-rpath "$(patchelf --print-rpath $out/bin/$binaryName):$out/lib:${libXv}/lib" \
|
2017-02-19 16:44:53 +00:00
|
|
|
$out/bin/$binaryName
|
2023-08-14 17:00:07 +00:00
|
|
|
|
|
|
|
addOpenGLRunpath $out/bin/$binaryName
|
2017-01-29 21:29:39 +00:00
|
|
|
'';
|
|
|
|
|
2017-05-23 21:56:00 +00:00
|
|
|
passthru = {
|
|
|
|
inherit libXNVCtrl;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.nvidia.com/object/unix.html";
|
2017-01-29 21:29:39 +00:00
|
|
|
description = "Settings application for NVIDIA graphics cards";
|
|
|
|
license = licenses.unfreeRedistributable;
|
2018-03-27 13:40:15 +00:00
|
|
|
platforms = nvidia_x11.meta.platforms;
|
2023-08-13 14:52:23 +00:00
|
|
|
mainProgram = "nvidia-settings";
|
2017-01-29 21:29:39 +00:00
|
|
|
maintainers = with maintainers; [ abbradar ];
|
|
|
|
};
|
|
|
|
}
|