about summary refs log tree commit diff
path: root/pkgs/games/build-support/build-unity.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/games/build-support/build-unity.nix')
-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
   '';