diff options
author | Nikolay Amiantov <ab@fmap.me> | 2017-04-23 15:54:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-23 15:54:56 +0300 |
commit | 9f6baaa89a5428eac9c133a136faffc3ee5fd52d (patch) | |
tree | 998037c81b9998669897701885bc4fc988d08e5d /pkgs/applications/networking/mailreaders/thunderbird | |
parent | fa652cef2211c95467451fb3d3e8617e7fa07264 (diff) | |
parent | eb8f604456516b22045f1f49707da98fd7c3e3fd (diff) | |
download | nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar.gz nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar.bz2 nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar.lz nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar.xz nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.tar.zst nixlib-9f6baaa89a5428eac9c133a136faffc3ee5fd52d.zip |
Merge pull request #24961 from layus/thunderbird-default-mail-client
Thunderbird: Fix default mail client detection
Diffstat (limited to 'pkgs/applications/networking/mailreaders/thunderbird')
-rw-r--r-- | pkgs/applications/networking/mailreaders/thunderbird/default.nix | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix index bb82cac0e84d..3e3b43aedb4f 100644 --- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix +++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix @@ -6,7 +6,7 @@ , cairo, gstreamer, gst-plugins-base, icu, libpng, jemalloc , autoconf213, which, m4 , writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl -, enableGTK3 ? false, gtk3, wrapGAppsHook +, enableGTK3 ? false, gtk3, wrapGAppsHook, makeWrapper , enableCalendar ? true , debugBuild ? false , # If you want the resulting program to call itself "Thunderbird" instead @@ -15,9 +15,12 @@ # Mozilla Foundation, see # http://www.mozilla.org/foundation/trademarks/. enableOfficialBranding ? false +, makeDesktopItem }: -stdenv.mkDerivation rec { +let + wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper; +in stdenv.mkDerivation rec { name = "thunderbird-${version}"; version = "52.0.1"; @@ -46,8 +49,8 @@ stdenv.mkDerivation rec { ] ++ lib.optional enableGTK3 gtk3; - # from firefox + m4 - nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python ] ++ lib.optional enableGTK3 wrapGAppsHook; + # from firefox + m4 + wrapperTool + nativeBuildInputs = [ m4 autoconf213 which gnused pkgconfig perl python wrapperTool ]; configureFlags = [ # from firefox, but without sound libraries (alsa, libvpx, pulseaudio) @@ -100,13 +103,61 @@ stdenv.mkDerivation rec { paxmark m ../objdir/dist/bin/xpcshell ''; + dontWrapGApps = true; # we do it ourselves postInstall = '' # For grsecurity kernels paxmark m $out/lib/thunderbird-[0-9]*/thunderbird - # Needed to find Mozilla runtime - gappsWrapperArgs+=(--argv0 "$out/bin/.thunderbird-wrapped") + # TODO: Move to a dev output? + rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl + + # $binary is a symlink to $target. + # We wrap $target by replacing the $binary symlink. + local target="$out/lib/thunderbird-${version}/thunderbird" + local binary="$out/bin/thunderbird" + + # Wrap correctly, this is needed to + # 1) find Mozilla runtime, because argv0 must be the real thing, + # or a symlink thereto. It cannot be the wrapper itself + # 2) detect itself as the default mailreader across builds + gappsWrapperArgs+=( + --argv0 "$target" + --set MOZ_APP_LAUNCHER thunderbird + ) + ${ + # We wrap manually because wrapGAppsHook does not detect the symlink + # To mimic wrapGAppsHook, we run it with dontWrapGApps, so + # gappsWrapperArgs gets defined correctly + lib.optionalString enableGTK3 "wrapGAppsHook" + } + + # "$binary" is a symlink, replace it by the wrapper + rm "$binary" + makeWrapper "$target" "$binary" "''${gappsWrapperArgs[@]}" + + ${ let desktopItem = makeDesktopItem { + name = "thunderbird"; + exec = "thunderbird %U"; + desktopName = "Thunderbird"; + icon = "$out/lib/thunderbird-${version}/chrome/icons/default/default256.png"; + genericName = "Main Reader"; + categories = "Application;Network"; + mimeType = stdenv.lib.concatStringsSep ";" [ + # Email + "x-scheme-handler/mailto" + "message/rfc822" + # Newsgroup + "x-scheme-handler/news" + "x-scheme-handler/snews" + "x-scheme-handler/nntp" + # Feed + "x-scheme-handler/feed" + "application/rss+xml" + "application/x-extension-rss" + ]; + }; in desktopItem.buildCommand + } ''; postFixup = |