From 81489719f799ecb6a7407c37c61fb9501568ea96 Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 26 Apr 2022 21:38:07 +0200 Subject: [PATCH] godot-export-templates: strip export template file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stripping reduces the template size from around 500MB to 40MB for Linux. This is added explicitly here because mkDerivation does not automatically strip binaries in the template directory. This also impacts the size of the exported games and programs. For example, here are the size of the `oh-my-git` package using this template, without and with stripping: ``` ❯ du -sh result*/ 375M result-oh-my-git-without-strip/ 45M result-oh-my-git-with-strip/ ``` GitHub: closes https://github.com/NixOS/nixpkgs/issues/170470 --- pkgs/development/tools/godot/export-templates.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/tools/godot/export-templates.nix b/pkgs/development/tools/godot/export-templates.nix index bfcf3e3b3dca..9d306365f190 100644 --- a/pkgs/development/tools/godot/export-templates.nix +++ b/pkgs/development/tools/godot/export-templates.nix @@ -10,6 +10,14 @@ godot.overrideAttrs (oldAttrs: rec { mkdir -p "$out/share/godot/templates/${oldAttrs.version}.stable" cp bin/godot.x11.opt.64 $out/share/godot/templates/${oldAttrs.version}.stable/linux_x11_64_release ''; + + # https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html + # Stripping reduces the template size from around 500MB to 40MB for Linux. + # This also impacts the size of the exported games. + # This is added explicitly here because mkDerivation does not automatically + # strip binaries in the template directory. + stripAllList = (oldAttrs.stripAllList or []) ++ [ "share/godot/templates" ]; + outputs = [ "out" ]; meta.description = "Free and Open Source 2D and 3D game engine (export templates)";