Skip to content

Commit

Permalink
classicube: use makeDesktopItem
Browse files Browse the repository at this point in the history
  • Loading branch information
360ied authored and Mindavi committed Jan 7, 2023
1 parent 52519fd commit 2357991
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions pkgs/games/classicube/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
, fetchFromGitHub
, dos2unix
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, SDL2
, libGL
, curl
Expand All @@ -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
Expand Down Expand Up @@ -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; {
Expand Down

0 comments on commit 2357991

Please sign in to comment.