Commit dc97d2c2 authored by Joachim Breitner's avatar Joachim Breitner Committed by Artturin
Browse files

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
```
parent 9971ea96
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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