Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unigine-superposition: init at 1.1 #163820

Merged
merged 2 commits into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 146 additions & 0 deletions pkgs/applications/graphics/unigine-superposition/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{ lib
, glib
, stdenv
, dbus
, freetype
, fontconfig
, zlib
, qtquickcontrols2
, libXinerama
, libxcb
, libSM
, libXi
, libglvnd
, libXext
, libXrandr
, mailspring
, libX11
, libICE
, libXrender
, autoPatchelfHook
, makeWrapper
, mkDerivation
, xkeyboard_config
, fetchurl
, buildFHSUserEnv
, openal
, makeDesktopItem
}:

let

superposition = stdenv.mkDerivation rec{
pname = "unigine-superposition";
version = "1.1";

src = fetchurl {
url = "https://assets.unigine.com/d/Unigine_Superposition-${version}.run";
sha256 = "12hzlz792pf8pvxf13fww3qhahqzwzkxq9q3mq20hbhvaphbg7nd";
};

nativeBuildInputs = [
autoPatchelfHook
makeWrapper
];

buildInputs = [
glib
stdenv.cc.cc
dbus
freetype
fontconfig
zlib
qtquickcontrols2
libXinerama
libxcb
libSM
libXi
libglvnd
libXext
libXrandr
mailspring
libX11
libICE
libXrender
];

installPhase = ''
bash $src --target $name --noexec
mkdir -p $out/bin $out/lib/unigine/superposition/
cp -r $name/* $out/lib/unigine/superposition/
echo "exec $out/lib/unigine/superposition/Superposition" >> $out/bin/superposition
chmod +x $out/bin/superposition
wrapProgram $out/lib/unigine/superposition/Superposition \
--set QT_XKB_CONFIG_ROOT ${xkeyboard_config} \
--run "cd $out/lib/unigine/superposition/"
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
'';

dontUnpack = true;
dontWrapQtApps = true;

postPatchMkspecs = ''
cp -f $name/bin/superposition $out/lib/unigine/superposition/bin/superposition
'';
};

desktopItem = makeDesktopItem {
name = "Superposition";
exec = "Superposition";
genericName = "A GPU Stress test tool from the UNIGINE";
icon = "Superposition";
desktopName = "Superposition Benchmark";
};

in

# We can patch the "/bin/superposition", but "/bin/launcher" checks it for changes.
# For that we need use a buildFHSUserEnv.

buildFHSUserEnv {
name = "Superposition";

targetPkgs = pkgs: [
superposition
glib
stdenv.cc.cc
dbus
freetype
fontconfig
zlib
qtquickcontrols2
libXinerama
libxcb
libSM
libXi
libglvnd
libXext
libXrandr
mailspring
libX11
libICE
libXrender
openal
];
runScript = "superposition";

extraInstallCommands = ''
# create directories
mkdir -p $out/share/icons/hicolor $out/share/applications
# create .desktop file
ln -s ${desktopItem}/share/applications/* $out/share/applications
# install Superposition.desktop and icon
cp ${superposition}/lib/unigine/superposition/Superposition.png $out/share/icons/
for RES in 16 24 32 48 64 128 256; do
mkdir -p $out/share/icons/hicolor/"$RES"x"$RES"/apps
cp ${superposition}/lib/unigine/superposition/icons/superposition_icon_$RES.png $out/share/icons/hicolor/"$RES"x"$RES"/apps/Superposition.png
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
done
'';

meta = {
description = "The Unigine Superposition GPU benchmarking tool";
homepage = "https://benchmark.unigine.com/superposition";
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.BarinovMaxim ];
platforms = [ "x86_64-linux" ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29671,6 +29671,8 @@ with pkgs;

unigine-heaven = callPackage ../applications/graphics/unigine-heaven { };

unigine-superposition = libsForQt5.callPackage ../applications/graphics/unigine-superposition { };

unipicker = callPackage ../applications/misc/unipicker { };

unison = callPackage ../applications/networking/sync/unison {
Expand Down