git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #107122 from nh2/thunderbird-gpgme

thunderbird: Add gpg/gpgme dependencies to fix smartcard usage

commitdb9a28338f4bfa0c571881eec4745bae2708b42f authorNiklas Hambüchen <mail@nh2.me> dateWed 23 Dec 2020, 22:14 (6 years ago) parentf1584ed4437248
2 files changed+41−21
pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix+26−19 pkgs/applications/networking/mailreaders/thunderbird/default.nix+15−2
pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix+26−19
@@ -1,22 +1,31 @@
1−{ stdenv, fetchurl, config, makeWrapper
1+{ stdenv, lib, fetchurl, config, makeWrapper
22, alsaLib
33, at-spi2-atk
44, atk
55, cairo
6+, coreutils
67, cups
78, curl
8−, dbus-glib
99, dbus
10+, dbus-glib
1011, fontconfig
1112, freetype
1213, gdk-pixbuf
1314, glib
1415, glibc
16+, gnome3
17+, gnugrep
18+, gnupg
19+, gnused
20+, gpgme
1521, gtk2
1622, gtk3
1723, kerberos
24+, libcanberra
25+, libGL
26+, libGLU
1827, libX11
19−, libXScrnSaver
28+, libxcb
2029, libXcomposite
2130, libXcursor
2231, libXdamage
@@ -25,21 +34,14 @@
2534, libXi
2635, libXinerama
2736, libXrender
37+, libXScrnSaver
2838, libXt
29−, libxcb
30−, libcanberra
31−, gnome3
32−, libGLU, libGL
3339, nspr
3440, nss
3541, pango
42+, runtimeShell
3643, writeScript
3744, xidel
38−, coreutils
39−, gnused
40−, gnugrep
41−, gnupg
42−, runtimeShell
4345}:
4446
4547# imports `version` and `sources`
@@ -58,9 +60,9 @@ let
5860
5961 systemLocale = config.i18n.defaultLocale or "en-US";
6062
61− defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources;
63+ defaultSource = lib.findFirst (sourceMatches "en-US") {} sources;
6264
63− source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources;
65+ source = lib.findFirst (sourceMatches systemLocale) defaultSource sources;
6466
6567 name = "thunderbird-bin-${version}";
6668in
@@ -75,7 +77,7 @@ stdenv.mkDerivation {
7577
7678 phases = "unpackPhase installPhase";
7779
78− libPath = stdenv.lib.makeLibraryPath
80+ libPath = lib.makeLibraryPath
7981 [ stdenv.cc.cc
8082 alsaLib
8183 at-spi2-atk
@@ -110,7 +112,7 @@ stdenv.mkDerivation {
110112 nspr
111113 nss
112114 pango
113− ] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
115+ ] + ":" + lib.makeSearchPathOutput "lib" "lib64" [
114116 stdenv.cc.cc
115117 ];
116118
@@ -118,6 +120,9 @@ stdenv.mkDerivation {
118120
119121 nativeBuildInputs = [ makeWrapper ];
120122
123+ # See "Note on GPG support" in `../thunderbird/default.nix` for explanations
124+ # on adding `gnupg` and `gpgme` into PATH/LD_LIBRARY_PATH.
125+
121126 installPhase =
122127 ''
123128 mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}"
@@ -158,7 +163,9 @@ stdenv.mkDerivation {
158163 --suffix XDG_DATA_DIRS : "$XDG_ICON_DIRS" \
159164 --set SNAP_NAME "thunderbird" \
160165 --set MOZ_LEGACY_PROFILES 1 \
161− --set MOZ_ALLOW_DOWNGRADE 1
166+ --set MOZ_ALLOW_DOWNGRADE 1 \
167+ --prefix PATH : "${lib.getBin gnupg}/bin" \
168+ --prefix LD_LIBRARY_PATH : "${lib.getLib gpgme}/lib"
162169 '';
163170
164171 passthru.updateScript = import ./../../browsers/firefox-bin/update.nix {
@@ -168,14 +175,14 @@ stdenv.mkDerivation {
168175 basePath = "pkgs/applications/networking/mailreaders/thunderbird-bin";
169176 baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
170177 };
171− meta = with stdenv.lib; {
178+ meta = with lib; {
172179 description = "Mozilla Thunderbird, a full-featured email client (binary package)";
173180 homepage = "http://www.mozilla.org/thunderbird/";
174181 license = {
175182 free = false;
176183 url = "http://www.mozilla.org/en-US/foundation/trademarks/policy/";
177184 };
178− maintainers = with stdenv.lib.maintainers; [ ];
185+ maintainers = with lib.maintainers; [ ];
179186 platforms = platforms.linux;
180187 };
181188}
pkgs/applications/networking/mailreaders/thunderbird/default.nix+15−2
@@ -14,13 +14,15 @@
1414, freetype
1515, glib
1616, gnugrep
17+, gnupg
1718, gnused
19+, gpgme
1820, icu
1921, jemalloc
2022, lib
23+, libevent
2124, libGL
2225, libGLU
23−, libevent
2426, libjpeg
2527, libnotify
2628, libpng
@@ -288,6 +290,15 @@ stdenv.mkDerivation rec {
288290 rm -rf $out/include $out/lib/thunderbird-devel-* $out/share/idl
289291 '';
290292
293+ # Note on GPG support:
294+ # Thunderbird's native GPG support does not yet support smartcards.
295+ # The official upstream recommendation is to configure fall back to gnupg
296+ # using the Thunderbird config `mail.openpgp.allow_external_gnupg`
297+ # and GPG keys set up; instructions with pictures at:
298+ # https://anweshadas.in/how-to-use-yubikey-or-any-gpg-smartcard-in-thunderbird-78/
299+ # For that to work out of the box, it requires `gnupg` on PATH and
300+ # `gpgme` in `LD_LIBRARY_PATH`; we do this below.
301+
291302 preFixup = ''
292303 # Needed to find Mozilla runtime
293304 gappsWrapperArgs+=(
@@ -297,6 +308,8 @@ stdenv.mkDerivation rec {
297308 --set SNAP_NAME "thunderbird"
298309 --set MOZ_LEGACY_PROFILES 1
299310 --set MOZ_ALLOW_DOWNGRADE 1
311+ --prefix PATH : "${lib.getBin gnupg}/bin"
312+ --prefix LD_LIBRARY_PATH : "${lib.getLib gpgme}/lib"
300313 )
301314 '';
302315
@@ -325,7 +338,7 @@ stdenv.mkDerivation rec {
325338
326339 requiredSystemFeatures = [ "big-parallel" ];
327340
328− meta = with stdenv.lib; {
341+ meta = with lib; {
329342 description = "A full-featured e-mail client";
330343 homepage = "https://www.thunderbird.net";
331344 maintainers = with maintainers; [