From 6b006fc4defe3c4be59a896b51b4e611440e4761 Mon Sep 17 00:00:00 2001 From: Tomo <68489118+Tomodachi94@users.noreply.github.com> Date: Sat, 4 May 2024 11:55:12 -0700 Subject: [PATCH 1/3] craftos-pc: reduce runtime dependencies patchelf is only used in the installPhase and is not used in the program itself, so we move it to nativeBuildInputs to reduce the closure size. --- pkgs/applications/emulators/craftos-pc/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/emulators/craftos-pc/default.nix b/pkgs/applications/emulators/craftos-pc/default.nix index 9ad54f00d4e8..e81bfeb9978e 100644 --- a/pkgs/applications/emulators/craftos-pc/default.nix +++ b/pkgs/applications/emulators/craftos-pc/default.nix @@ -40,7 +40,8 @@ stdenv.mkDerivation rec { hash = "sha256-ozebHgUgwdqYtWAyL+EdwpjEvZC+PkWcLYCPWz2FjSw="; }; - buildInputs = [ patchelf poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ]; + nativeBuildInputs = [ patchelf ]; + buildInputs = [ poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ]; preBuild = '' cp -R ${craftos2-lua}/* ./craftos2-lua/ From f3ac1b3b0a29e973982915fe560447d9dc93fa4b Mon Sep 17 00:00:00 2001 From: Tomo <68489118+Tomodachi94@users.noreply.github.com> Date: Sat, 4 May 2024 13:47:07 -0700 Subject: [PATCH 2/3] 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. --- pkgs/applications/emulators/craftos-pc/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/emulators/craftos-pc/default.nix b/pkgs/applications/emulators/craftos-pc/default.nix index e81bfeb9978e..fe2654a31fc7 100644 --- a/pkgs/applications/emulators/craftos-pc/default.nix +++ b/pkgs/applications/emulators/craftos-pc/default.nix @@ -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 = { From 6631259d7c64907c02b721987a39265d02915e39 Mon Sep 17 00:00:00 2001 From: Tomo <68489118+Tomodachi94@users.noreply.github.com> Date: Sun, 5 May 2024 11:06:35 -0700 Subject: [PATCH 3/3] craftos-pc: enable strictDeps --- pkgs/applications/emulators/craftos-pc/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/emulators/craftos-pc/default.nix b/pkgs/applications/emulators/craftos-pc/default.nix index fe2654a31fc7..0d077d7669f2 100644 --- a/pkgs/applications/emulators/craftos-pc/default.nix +++ b/pkgs/applications/emulators/craftos-pc/default.nix @@ -43,6 +43,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ patchelf unzip ]; buildInputs = [ poco openssl SDL2 SDL2_mixer ncurses libpng pngpp libwebp ]; + strictDeps = true; preBuild = '' cp -R ${craftos2-lua}/* ./craftos2-lua/