|
| 1 | +{ stdenv, fetchurl, config, makeWrapper |
| 2 | +, gconf |
| 3 | +, alsaLib |
| 4 | +, at-spi2-atk |
| 5 | +, atk |
| 6 | +, cairo |
| 7 | +, cups |
| 8 | +, curl |
| 9 | +, dbus-glib |
| 10 | +, dbus |
| 11 | +, fontconfig |
| 12 | +, freetype |
| 13 | +, gdk-pixbuf |
| 14 | +, glib |
| 15 | +, glibc |
| 16 | +, gst-plugins-base |
| 17 | +, gstreamer |
| 18 | +, gtk2 |
| 19 | +, gtk3 |
| 20 | +, kerberos |
| 21 | +, libX11 |
| 22 | +, libXScrnSaver |
| 23 | +, libXcomposite |
| 24 | +, libXcursor |
| 25 | +, libXdamage |
| 26 | +, libXext |
| 27 | +, libXfixes |
| 28 | +, libXi |
| 29 | +, libXinerama |
| 30 | +, libXrender |
| 31 | +, libXt |
| 32 | +, libxcb |
| 33 | +, libcanberra-gtk2 |
| 34 | +, libgnome |
| 35 | +, libgnomeui |
| 36 | +, gnome3 |
| 37 | +, libGLU, libGL |
| 38 | +, nspr |
| 39 | +, nss |
| 40 | +, pango |
| 41 | +, writeScript |
| 42 | +, xidel |
| 43 | +, coreutils |
| 44 | +, gnused |
| 45 | +, gnugrep |
| 46 | +, gnupg |
| 47 | +, runtimeShell |
| 48 | +}: |
| 49 | + |
| 50 | +# imports `version` and `sources` |
| 51 | +with (import ./68_sources.nix); |
| 52 | + |
| 53 | +let |
| 54 | + arch = if stdenv.hostPlatform.system == "i686-linux" |
| 55 | + then "linux-i686" |
| 56 | + else "linux-x86_64"; |
| 57 | + |
| 58 | + isPrefixOf = prefix: string: |
| 59 | + builtins.substring 0 (builtins.stringLength prefix) string == prefix; |
| 60 | + |
| 61 | + sourceMatches = locale: source: |
| 62 | + (isPrefixOf source.locale locale) && source.arch == arch; |
| 63 | + |
| 64 | + systemLocale = config.i18n.defaultLocale or "en-US"; |
| 65 | + |
| 66 | + defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources; |
| 67 | + |
| 68 | + source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources; |
| 69 | + |
| 70 | + name = "thunderbird-bin-${version}"; |
| 71 | +in |
| 72 | + |
| 73 | +stdenv.mkDerivation { |
| 74 | + inherit name; |
| 75 | + |
| 76 | + src = fetchurl { |
| 77 | + url = "https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/${version}/${source.arch}/${source.locale}/thunderbird-${version}.tar.bz2"; |
| 78 | + inherit (source) sha512; |
| 79 | + }; |
| 80 | + |
| 81 | + phases = "unpackPhase installPhase"; |
| 82 | + |
| 83 | + libPath = stdenv.lib.makeLibraryPath |
| 84 | + [ stdenv.cc.cc |
| 85 | + gconf |
| 86 | + alsaLib |
| 87 | + at-spi2-atk |
| 88 | + atk |
| 89 | + cairo |
| 90 | + cups |
| 91 | + curl |
| 92 | + dbus-glib |
| 93 | + dbus |
| 94 | + fontconfig |
| 95 | + freetype |
| 96 | + gdk-pixbuf |
| 97 | + glib |
| 98 | + glibc |
| 99 | + gst-plugins-base |
| 100 | + gstreamer |
| 101 | + gtk2 |
| 102 | + gtk3 |
| 103 | + kerberos |
| 104 | + libX11 |
| 105 | + libXScrnSaver |
| 106 | + libXcomposite |
| 107 | + libXcursor |
| 108 | + libXdamage |
| 109 | + libXext |
| 110 | + libXfixes |
| 111 | + libXi |
| 112 | + libXinerama |
| 113 | + libXrender |
| 114 | + libXt |
| 115 | + libxcb |
| 116 | + libcanberra-gtk2 |
| 117 | + libgnome |
| 118 | + libgnomeui |
| 119 | + libGLU libGL |
| 120 | + nspr |
| 121 | + nss |
| 122 | + pango |
| 123 | + ] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [ |
| 124 | + stdenv.cc.cc |
| 125 | + ]; |
| 126 | + |
| 127 | + buildInputs = [ gtk3 gnome3.adwaita-icon-theme ]; |
| 128 | + |
| 129 | + nativeBuildInputs = [ makeWrapper ]; |
| 130 | + |
| 131 | + installPhase = |
| 132 | + '' |
| 133 | + mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}" |
| 134 | + cp -r * "$prefix/usr/lib/thunderbird-bin-${version}" |
| 135 | +
|
| 136 | + mkdir -p "$out/bin" |
| 137 | + ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/" |
| 138 | +
|
| 139 | + for executable in \ |
| 140 | + thunderbird crashreporter thunderbird-bin plugin-container updater |
| 141 | + do |
| 142 | + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ |
| 143 | + "$out/usr/lib/thunderbird-bin-${version}/$executable" |
| 144 | + done |
| 145 | +
|
| 146 | + find . -executable -type f -exec \ |
| 147 | + patchelf --set-rpath "$libPath" \ |
| 148 | + "$out/usr/lib/thunderbird-bin-${version}/{}" \; |
| 149 | +
|
| 150 | + # Create a desktop item. |
| 151 | + mkdir -p $out/share/applications |
| 152 | + cat > $out/share/applications/thunderbird.desktop <<EOF |
| 153 | + [Desktop Entry] |
| 154 | + Type=Application |
| 155 | + Exec=$out/bin/thunderbird |
| 156 | + Icon=$out/usr/lib/thunderbird-bin-${version}/chrome/icons/default/default256.png |
| 157 | + Name=Thunderbird |
| 158 | + GenericName=Mail Reader |
| 159 | + Categories=Application;Network; |
| 160 | + EOF |
| 161 | +
|
| 162 | + # SNAP_NAME: https://github.com/NixOS/nixpkgs/pull/61980 |
| 163 | + # MOZ_LEGACY_PROFILES and MOZ_ALLOW_DOWNGRADE: |
| 164 | + # commit 87e261843c4236c541ee0113988286f77d2fa1ee |
| 165 | + wrapProgram "$out/bin/thunderbird" \ |
| 166 | + --argv0 "$out/bin/.thunderbird-wrapped" \ |
| 167 | + --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:" \ |
| 168 | + --suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS" \ |
| 169 | + --set SNAP_NAME "thunderbird" \ |
| 170 | + --set MOZ_LEGACY_PROFILES 1 \ |
| 171 | + --set MOZ_ALLOW_DOWNGRADE 1 |
| 172 | + ''; |
| 173 | + |
| 174 | + passthru.updateScript = import ./../../browsers/firefox-bin/update.nix { |
| 175 | + inherit name writeScript xidel coreutils gnused gnugrep curl gnupg runtimeShell; |
| 176 | + baseName = "thunderbird"; |
| 177 | + channel = "release"; |
| 178 | + basePath = "pkgs/applications/networking/mailreaders/thunderbird-bin"; |
| 179 | + baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/"; |
| 180 | + }; |
| 181 | + meta = with stdenv.lib; { |
| 182 | + description = "Mozilla Thunderbird, a full-featured email client (binary package)"; |
| 183 | + homepage = http://www.mozilla.org/thunderbird/; |
| 184 | + license = { |
| 185 | + free = false; |
| 186 | + url = http://www.mozilla.org/en-US/foundation/trademarks/policy/; |
| 187 | + }; |
| 188 | + maintainers = with stdenv.lib.maintainers; [ ]; |
| 189 | + platforms = platforms.linux; |
| 190 | + }; |
| 191 | +} |
0 commit comments