craftos-pc: install icons and .desktop file

Upstream provides icons and a .desktop file in the
resources/linux-icons.zip file.

This PR properly installs these assets.
This commit is contained in:
Tomo 2024-05-04 13:47:07 -07:00
parent 6b006fc4de
commit f3ac1b3b0a

View file

@ -3,6 +3,7 @@
, fetchFromGitHub
, callPackage
, patchelf
, unzip
, poco
, openssl
, SDL2
@ -40,7 +41,7 @@ stdenv.mkDerivation rec {
hash = "sha256-ozebHgUgwdqYtWAyL+EdwpjEvZC+PkWcLYCPWz2FjSw=";
};
nativeBuildInputs = [ patchelf ];
nativeBuildInputs = [ patchelf unzip ];
buildInputs = [ poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ];
preBuild = ''
@ -64,6 +65,17 @@ stdenv.mkDerivation rec {
patchelf --replace-needed craftos2-lua/src/liblua.so liblua.so $out/bin/craftos
cp -R api $out/include/CraftOS-PC
cp -R ${craftos2-rom}/* $out/share/craftos
mkdir -p resources/linux-icons
unzip resources/linux-icons.zip -d resources/linux-icons
for dim in 16 24 32 48 64 96 128 256 1024; do
dir="$out/share/icons/hicolor/$dimx$dim/apps"
mkdir -p "$dir"
cp "resources/linux-icons/$dim.png" "$dir/craftos.png"
done
mkdir -p $out/share/applications
cp resources/linux-icons/CraftOS-PC.desktop $out/share/applications/CraftOS-PC.desktop
'';
passthru.tests = {