nixpkgs/pkgs/applications/graphics/unigine-superposition/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

151 lines
3.3 KiB
Nix

{
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,
buildFHSEnv,
openal,
makeDesktopItem,
}:
let
pname = "unigine-superposition";
version = "1.1";
superposition = stdenv.mkDerivation rec {
inherit pname version;
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/"
'';
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 buildFHSEnv.
buildFHSEnv {
inherit pname version;
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
done
'';
meta = {
description = "Unigine Superposition GPU benchmarking tool";
homepage = "https://benchmark.unigine.com/superposition";
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.BarinovMaxim ];
platforms = [ "x86_64-linux" ];
mainProgram = "Superposition";
};
}