nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 mkDerivation,
5 fetchurl,
6 freetype,
7 glib,
8 libGL,
9 libGLU,
10 libSM,
11
12 libXcomposite,
13 libXi,
14 libXrender,
15 libX11,
16
17 libxcb,
18 sqlite,
19 zlib,
20 fontconfig,
21 dpkg,
22 libproxy,
23 libxml2,
24 gst_all_1,
25 dbus,
26 makeWrapper,
27
28 cups,
29 alsa-lib,
30
31 xkeyboardconfig,
32 autoPatchelfHook,
33}:
34let
35 arch =
36 if stdenv.hostPlatform.system == "x86_64-linux" then
37 "amd64"
38 else
39 throw "Unsupported system ${stdenv.hostPlatform.system} ";
40
41 libxml2' = libxml2.overrideAttrs rec {
42 version = "2.13.8";
43 src = fetchurl {
44 url = "mirror://gnome/sources/libxml2/${lib.versions.majorMinor version}/libxml2-${version}.tar.xz";
45 hash = "sha256-J3KUyzMRmrcbK8gfL0Rem8lDW4k60VuyzSsOhZoO6Eo=";
46 };
47 };
48in
49mkDerivation rec {
50 pname = "googleearth-pro";
51 version = "7.3.6.10201";
52
53 src = fetchurl {
54 url = "https://dl.google.com/linux/earth/deb/pool/main/g/google-earth-pro-stable/google-earth-pro-stable_${version}-r0_${arch}.deb";
55 sha256 = "sha256-LqkXOSfE52+7x+Y0DBjYzvVKO0meytLNHuS/ia88FbI=";
56 };
57
58 nativeBuildInputs = [
59 dpkg
60 makeWrapper
61 autoPatchelfHook
62 ];
63 propagatedBuildInputs = [ xkeyboardconfig ];
64 buildInputs = [
65 dbus
66 cups
67 fontconfig
68 freetype
69 glib
70 gst_all_1.gst-plugins-base
71 gst_all_1.gstreamer
72 libGL
73 libGLU
74 libSM
75 libX11
76 libXcomposite
77 libXi
78 libXrender
79 libproxy
80 libxcb
81 libxml2'
82 sqlite
83 zlib
84 alsa-lib
85 ];
86
87 doInstallCheck = true;
88
89 dontBuild = true;
90
91 unpackPhase = ''
92 runHook preUnpack
93
94 # deb file contains a setuid binary, so 'dpkg -x' doesn't work here
95 mkdir deb
96 dpkg --fsys-tarfile $src | tar --extract -C deb
97
98 runHook postUnpack
99 '';
100
101 installPhase = ''
102 runHook preInstall
103
104 mkdir $out
105 mv deb/usr/* $out/
106 rmdir deb/usr
107 mv deb/* $out/
108 rm $out/bin/google-earth-pro $out/opt/google/earth/pro/googleearth
109
110 # patch and link googleearth binary
111 ln -s $out/opt/google/earth/pro/googleearth-bin $out/bin/googleearth-pro
112
113 # patch and link gpsbabel binary
114 ln -s $out/opt/google/earth/pro/gpsbabel $out/bin/gpsbabel
115
116 # Add desktop config file and icons
117 mkdir -p $out/share/{applications,icons/hicolor/{16x16,22x22,24x24,32x32,48x48,64x64,128x128,256x256}/apps,pixmaps}
118 ln -s $out/opt/google/earth/pro/google-earth-pro.desktop $out/share/applications/google-earth-pro.desktop
119 sed -i -e "s|Exec=.*|Exec=$out/bin/googleearth-pro|g" $out/opt/google/earth/pro/google-earth-pro.desktop
120 for size in 16 22 24 32 48 64 128 256; do
121 ln -s $out/opt/google/earth/pro/product_logo_"$size".png $out/share/icons/hicolor/"$size"x"$size"/apps/google-earth-pro.png
122 done
123 ln -s $out/opt/google/earth/pro/product_logo_256.png $out/share/pixmaps/google-earth-pro.png
124
125 runHook postInstall
126 '';
127
128 installCheckPhase = ''
129 $out/bin/gpsbabel -V > /dev/null
130 '';
131
132 # wayland is not supported by Qt included in binary package, so make sure it uses xcb
133 postFixup = ''
134 wrapProgram $out/bin/googleearth-pro \
135 --set QT_QPA_PLATFORM xcb \
136 --set QT_XKB_CONFIG_ROOT "${xkeyboardconfig}/share/X11/xkb"
137 '';
138
139 meta = with lib; {
140 description = "World sphere viewer";
141 homepage = "https://www.google.com/earth/";
142 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
143 license = licenses.unfree;
144 maintainers = with maintainers; [
145 shamilton
146 xddxdd
147 ];
148 platforms = platforms.linux;
149 knownVulnerabilities = [
150 "Includes vulnerable versions of bundled libraries: openssl, ffmpeg, gdal, and proj."
151 ];
152 };
153}