ballerburg: include desktop file and icon

+33 -3
+33 -3
pkgs/games/ballerburg/default.nix
··· 1 - { lib, stdenv, fetchurl, cmake, SDL }: 1 + { lib, stdenv, fetchurl, cmake, SDL, makeDesktopItem, copyDesktopItems 2 + , imagemagick }: 3 + 4 + let 2 5 3 - stdenv.mkDerivation rec { 6 + icon = fetchurl { 7 + url = "https://baller.tuxfamily.org/king.png"; 8 + sha256 = "1xq2h87s648wjpjl72ds3xnnk2jp8ghbkhjzh2g4hpkq2zdz90hy"; 9 + }; 10 + 11 + in stdenv.mkDerivation rec { 4 12 pname = "ballerburg"; 5 13 version = "1.2.0"; 6 14 ··· 9 17 sha256 = "sha256-BiX0shPBGA8sshee8rxs41x+mdsrJzBqhpDDic6sYwA="; 10 18 }; 11 19 12 - nativeBuildInputs = [ cmake ]; 20 + nativeBuildInputs = [ cmake copyDesktopItems imagemagick ]; 13 21 14 22 buildInputs = [ SDL ]; 23 + 24 + desktopItems = [ 25 + (makeDesktopItem { 26 + name = "Ballerburg"; 27 + desktopName = "Ballerburg SDL"; 28 + type = "Application"; 29 + exec = "_NET_WM_ICON=ballerburg ballerburg"; 30 + comment = meta.description; 31 + icon = "ballerburg"; 32 + categories = "Game;"; 33 + }) 34 + ]; 35 + 36 + postInstall = '' 37 + # Generate and install icon files 38 + for size in 16 32 48 64 72 96 128 192 512 1024; do 39 + mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps 40 + convert ${icon} -sample "$size"x"$size" \ 41 + -background white -gravity south -extent "$size"x"$size" \ 42 + $out/share/icons/hicolor/"$size"x"$size"/apps/ballerburg.png 43 + done 44 + ''; 15 45 16 46 meta = with lib; { 17 47 description = "Classic cannon combat game";