about summary refs log tree commit diff
path: root/pkgs/games/build-support
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-09-10 09:12:23 +0200
committeraszlig <aszlig@redmoonstudios.org>2017-09-10 09:12:23 +0200
commitcfe9d6415d8775cf7de7c29b844523fccd780265 (patch)
tree694b27ecf8067555ebd6370a56cf57554c447c79 /pkgs/games/build-support
parentece7f0effed4f33eec1894ae9a4dbb6c97958c3a (diff)
pkgs/build-unity: Create desktop entry
This automatically creates a desktop entry based on the given fullName
and the standard path for the icon (Resources/UnityPlayer.png).

Well, at least I hope that the icon path is standard, but we'll see once
we use buildUnity for more games.

Tested using Plasma 5 for Invisigun Heroes.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/games/build-support')
-rw-r--r--pkgs/games/build-support/build-unity.nix21
1 files changed, 19 insertions, 2 deletions
diff --git a/pkgs/games/build-support/build-unity.nix b/pkgs/games/build-support/build-unity.nix
index e6c0162d..dfd69bba 100644
--- a/pkgs/games/build-support/build-unity.nix
+++ b/pkgs/games/build-support/build-unity.nix
@@ -9,7 +9,7 @@ let
 
 in stdenv.mkDerivation ({
   name = "${name}-${version}";
-  inherit version arch executable dataDir;
+  inherit fullName version arch executable dataDir;
   slugName = name;
 
   nativeBuildInputs = [ makeWrapper ];
@@ -40,9 +40,26 @@ in stdenv.mkDerivation ({
     mkdir -p "$out/bin"
     makeWrapper "$out/libexec/$slugName/$slugName" "$out/bin/$slugName"
 
-    mkdir -p "$out/share"
+    iconpath="$out/share/$slugName/Resources/UnityPlayer.png"
+    mkdir -p "$out/share/applications"
+    cat > "$out/share/applications/$slugName.desktop" <<EOF
+    [Desktop Entry]
+    Name=$fullName
+    Type=Application
+    Version=1.1
+    Exec=$out/bin/$slugName
+    Icon=$iconpath
+    Categories=Game
+    StartupNotify=true
+    EOF
+
     cp -vRd "$dataDir" "$out/share/$slugName"
 
+    if [ ! -e "$iconpath" ]; then
+      echo "Desktop icon not found at $iconpath." >&2
+      exit 1
+    fi
+
     runHook postInstall
   '';