about summary refs log tree commit diff
path: root/pkgs/games/classicube
diff options
context:
space:
mode:
author360ied <19516527+360ied@users.noreply.github.com>2022-12-27 16:49:58 -0500
committerRick van Schijndel <Mindavi@users.noreply.github.com>2023-01-07 05:28:13 +0100
commit235799128bfccb6048f36a86e9d32545efca0372 (patch)
tree52bf7caa37610536c3e9501bade7c6de4c785b56 /pkgs/games/classicube
parent52519fd12e639abdc4dbc8e054f73d68c923a505 (diff)
classicube: use makeDesktopItem
Diffstat (limited to 'pkgs/games/classicube')
-rw-r--r--pkgs/games/classicube/default.nix31
1 files changed, 17 insertions, 14 deletions
diff --git a/pkgs/games/classicube/default.nix b/pkgs/games/classicube/default.nix
index a616a37ced0af..07eded71e7b87 100644
--- a/pkgs/games/classicube/default.nix
+++ b/pkgs/games/classicube/default.nix
@@ -3,6 +3,8 @@
 , fetchFromGitHub
 , dos2unix
 , makeWrapper
+, makeDesktopItem
+, copyDesktopItems
 , SDL2
 , libGL
 , curl
@@ -21,7 +23,19 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-m7pg9OL2RuCVKgFD3hMtIeY0XdJ1YviXBFVJH8/T5gI=";
   };
 
-  nativeBuildInputs = [ dos2unix makeWrapper ];
+  nativeBuildInputs = [ dos2unix makeWrapper copyDesktopItems ];
+
+  desktopItems = [
+    (makeDesktopItem {
+      name = pname;
+      desktopName = pname;
+      genericName = "Sandbox Block Game";
+      exec = "ClassiCube";
+      icon = "CCicon";
+      comment = "Minecraft Classic inspired sandbox game";
+      categories = [ "Game" ];
+    })
+  ];
 
   prePatch = ''
     # The ClassiCube sources have DOS-style newlines
@@ -77,20 +91,9 @@ stdenv.mkDerivation rec {
       --run 'mkdir -p "$HOME/.local/share/ClassiCube"' \
       --run 'cd       "$HOME/.local/share/ClassiCube"'
     runHook postInstall
-  '';
 
-  postInstall = ''
-    mkdir -p "$out/share/applications" "$out/share/resources"
-    cp 'misc/CCicon.png' "$out/share/resources"
-    cat >"$out/share/applications/ClassiCube.desktop" <<EOF
-    [Desktop Entry]
-    Type = Application
-    Exec = "$out/bin/ClassiCube"
-    Icon = "$out/share/resources/CCicon.png"
-    Name = ClassiCube
-    GenericName = Sandbox Block Game
-    Categories = ["Game"]
-    EOF
+    mkdir -p "$out/share/icons/hicolor/256x256/apps"
+    cp misc/CCicon.png "$out/share/icons/hicolor/256x256/apps"
   '';
 
   meta = with lib; {