nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 141 lines 3.9 kB view raw
1# Update instructions: 2# 3# To update `thunderbird-bin`'s `release_sources.nix`, run from the nixpkgs root: 4# 5# nix-shell maintainers/scripts/update.nix --argstr package pkgs.thunderbird-bin-unwrapped 6# nix-shell maintainers/scripts/update.nix --argstr package pkgs.thunderbird-esr-bin-unwrapped 7{ 8 lib, 9 stdenv, 10 fetchurl, 11 config, 12 wrapGAppsHook3, 13 autoPatchelfHook, 14 alsa-lib, 15 curl, 16 gtk3, 17 writeScript, 18 writeText, 19 xidel, 20 coreutils, 21 gnused, 22 gnugrep, 23 gnupg, 24 runtimeShell, 25 systemLocale ? config.i18n.defaultLocale or "en_US", 26 patchelfUnstable, # have to use patchelfUnstable to support --no-clobber-old-sections 27 generated, 28 versionSuffix ? "", 29 applicationName ? "Thunderbird", 30}: 31 32let 33 inherit (generated) version sources; 34 35 mozillaPlatforms = { 36 i686-linux = "linux-i686"; 37 x86_64-linux = "linux-x86_64"; 38 }; 39 40 arch = mozillaPlatforms.${stdenv.hostPlatform.system}; 41 42 isPrefixOf = prefix: string: builtins.substring 0 (builtins.stringLength prefix) string == prefix; 43 44 sourceMatches = locale: source: (isPrefixOf source.locale locale) && source.arch == arch; 45 46 policies = { 47 DisableAppUpdate = true; 48 } 49 // config.thunderbird.policies or { }; 50 policiesJson = writeText "thunderbird-policies.json" (builtins.toJSON { inherit policies; }); 51 52 defaultSource = lib.findFirst (sourceMatches "en-US") { } sources; 53 54 mozLocale = 55 if systemLocale == "ca_ES@valencia" then 56 "ca-valencia" 57 else 58 lib.replaceStrings [ "_" ] [ "-" ] systemLocale; 59 60 source = lib.findFirst (sourceMatches mozLocale) defaultSource sources; 61 62 pname = "thunderbird-bin"; 63in 64 65stdenv.mkDerivation { 66 inherit pname version; 67 68 src = fetchurl { 69 inherit (source) url sha256; 70 }; 71 72 nativeBuildInputs = [ 73 wrapGAppsHook3 74 autoPatchelfHook 75 patchelfUnstable 76 ]; 77 buildInputs = [ 78 alsa-lib 79 ]; 80 # Thunderbird uses "relrhack" to manually process relocations from a fixed offset 81 patchelfFlags = [ "--no-clobber-old-sections" ]; 82 83 patchPhase = '' 84 # Don't download updates from Mozilla directly 85 echo 'pref("app.update.auto", "false");' >> defaults/pref/channel-prefs.js 86 ''; 87 88 installPhase = '' 89 mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}" 90 cp -r * "$prefix/usr/lib/thunderbird-bin-${version}" 91 92 mkdir -p "$out/bin" 93 ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/" 94 95 # wrapThunderbird expects "$out/lib" instead of "$out/usr/lib" 96 ln -s "$out/usr/lib" "$out/lib" 97 98 gappsWrapperArgs+=(--argv0 "$out/bin/.thunderbird-wrapped") 99 100 # See: https://github.com/mozilla/policy-templates/blob/master/README.md 101 mkdir -p "$out/lib/thunderbird-bin-${version}/distribution"; 102 ln -s ${policiesJson} "$out/lib/thunderbird-bin-${version}/distribution/policies.json"; 103 ''; 104 105 passthru.updateScript = import ./../../browsers/firefox-bin/update.nix { 106 inherit 107 pname 108 writeScript 109 xidel 110 coreutils 111 gnused 112 gnugrep 113 curl 114 gnupg 115 runtimeShell 116 versionSuffix 117 ; 118 baseName = "thunderbird"; 119 basePath = "pkgs/applications/networking/mailreaders/thunderbird-bin"; 120 baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/"; 121 }; 122 123 passthru = { 124 inherit applicationName; 125 binaryName = "thunderbird"; 126 gssSupport = true; 127 gtk3 = gtk3; 128 }; 129 130 meta = { 131 changelog = "https://www.thunderbird.net/en-US/thunderbird/${version}/releasenotes/"; 132 description = "Mozilla Thunderbird, a full-featured email client (binary package)"; 133 homepage = "http://www.mozilla.org/thunderbird/"; 134 mainProgram = "thunderbird"; 135 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 136 license = lib.licenses.mpl20; 137 maintainers = with lib.maintainers; [ lovesegfault ]; 138 platforms = builtins.attrNames mozillaPlatforms; 139 hydraPlatforms = [ ]; 140 }; 141}