From dc97d2c2641b5491da4f34dd55683787ec8e0152 Mon Sep 17 00:00:00 2001 From: Joachim Breitner Date: Sun, 23 Apr 2023 14:29:19 +0200 Subject: [PATCH] googleearth-pro: Avoid dragging in stdenv I noticed that my system closure contained duplicate of various packages, and traced it back to `googleearth-pro`. It included a `env-vars` file created by `stdenv` which pulled in lots of build tools, and it seems it was copied in `installPhase` by accident. By only copying the directories from the upstream package, the number of paths in the closure is reduced noticably: ```diff ~/build/nixpkgs $ diff -u <(nix-store --query -R result-before|wc -l) <(nix-store --query -R result|wc -l) --- /dev/fd/63 2023-04-23 14:31:22.653577750 +0200 +++ /dev/fd/62 2023-04-23 14:31:22.654577714 +0200 @@ -1 +1 @@ -396 +256 $ du -sch $(nix-store -qR result-before) | grep total 1.5G total $ du -sch $(nix-store -qR result) | grep total 894M total ``` --- pkgs/applications/misc/googleearth-pro/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/misc/googleearth-pro/default.nix b/pkgs/applications/misc/googleearth-pro/default.nix index dd6964318e77..59912ef6b1ac 100644 --- a/pkgs/applications/misc/googleearth-pro/default.nix +++ b/pkgs/applications/misc/googleearth-pro/default.nix @@ -71,16 +71,17 @@ mkDerivation rec { unpackPhase = '' # deb file contains a setuid binary, so 'dpkg -x' doesn't work here - dpkg --fsys-tarfile ${src} | tar --extract + mkdir deb + dpkg --fsys-tarfile ${src} | tar --extract -C deb ''; installPhase ='' runHook preInstall mkdir $out - mv usr/* $out/ - rmdir usr - mv * $out/ + mv deb/usr/* $out/ + rmdir deb/usr + mv deb/* $out/ rm $out/bin/google-earth-pro $out/opt/google/earth/pro/googleearth # patch and link googleearth binary