diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix index c7d1222ef86d..98792527faf1 100644 --- a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix +++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix @@ -2,34 +2,25 @@ # # To update `thunderbird-bin`'s `release_sources.nix`, run from the nixpkgs root: # -# nix-shell maintainers/scripts/update.nix --argstr package pkgs.firefox-bin-unwrapped -{ stdenv, lib, fetchurl, config, makeWrapper +# nix-shell maintainers/scripts/update.nix --argstr package pkgs.thunderbird-bin-unwrapped +{ lib, stdenv, fetchurl, config, wrapGAppsHook , alsa-lib -, at-spi2-atk , atk , cairo -, coreutils -, cups , curl -, dbus +, cups , dbus-glib +, dbus , fontconfig , freetype , gdk-pixbuf , glib , glibc -, gnome -, gnugrep -, gnupg -, gnused -, gpgme , gtk2 , gtk3 , libkrb5 -, libcanberra -, libGL -, libGLU , libX11 +, libXScrnSaver , libxcb , libXcomposite , libXcursor @@ -39,24 +30,43 @@ , libXi , libXinerama , libXrender -, libXScrnSaver +, libXrandr , libXt +, libXtst +, libcanberra +, libnotify +, adwaita-icon-theme +, libGLU, libGL , nspr , nss , pango -, runtimeShell +, pipewire +, pciutils +, libheimdal +, libpulseaudio +, systemd , writeScript -, xdg-utils +, writeText , xidel +, coreutils +, gnused +, gnugrep +, gnupg +, ffmpeg +, runtimeShell +, mesa # thunderbird wants gbm for drm+dmabuf +, systemLocale ? config.i18n.defaultLocale or "en_US" }: -# imports `version` and `sources` -with (import ./release_sources.nix); - let - arch = if stdenv.hostPlatform.system == "i686-linux" - then "linux-i686" - else "linux-x86_64"; + inherit (import ./release_sources.nix) version sources; + + mozillaPlatforms = { + i686-linux = "linux-i686"; + x86_64-linux = "linux-x86_64"; + }; + + arch = mozillaPlatforms.${stdenv.hostPlatform.system}; isPrefixOf = prefix: string: builtins.substring 0 (builtins.stringLength prefix) string == prefix; @@ -64,11 +74,17 @@ let sourceMatches = locale: source: (isPrefixOf source.locale locale) && source.arch == arch; - systemLocale = config.i18n.defaultLocale or "en-US"; + policies = { DisableAppUpdate = true; } // config.thunderbird.policies or { }; + policiesJson = writeText "thunderbird-policies.json" (builtins.toJSON { inherit policies; }); defaultSource = lib.findFirst (sourceMatches "en-US") {} sources; - source = lib.findFirst (sourceMatches systemLocale) defaultSource sources; + mozLocale = + if systemLocale == "ca_ES@valencia" + then "ca-valencia" + else lib.replaceStrings ["_"] ["-"] systemLocale; + + source = lib.findFirst (sourceMatches mozLocale) defaultSource sources; in stdenv.mkDerivation { @@ -83,11 +99,10 @@ stdenv.mkDerivation { libPath = lib.makeLibraryPath [ stdenv.cc.cc alsa-lib - at-spi2-atk atk cairo - cups curl + cups dbus-glib dbus fontconfig @@ -98,34 +113,55 @@ stdenv.mkDerivation { gtk2 gtk3 libkrb5 + mesa libX11 libXScrnSaver libXcomposite libXcursor + libxcb libXdamage libXext libXfixes libXi libXinerama libXrender + libXrandr libXt - libxcb + libXtst libcanberra + libnotify libGLU libGL nspr nss pango + pipewire + pciutils + libheimdal + libpulseaudio + systemd + ffmpeg ] + ":" + lib.makeSearchPathOutput "lib" "lib64" [ stdenv.cc.cc ]; - buildInputs = [ gtk3 gnome.adwaita-icon-theme ]; + inherit gtk3; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ wrapGAppsHook ]; + + buildInputs = [ gtk3 adwaita-icon-theme ]; + + # "strip" after "patchelf" may break binaries. + # See: https://github.com/NixOS/patchelf/issues/10 + dontStrip = true; + dontPatchELF = true; + + patchPhase = '' + # Don't download updates from Mozilla directly + echo 'pref("app.update.auto", "false");' >> defaults/pref/channel-prefs.js + ''; # See "Note on GPG support" in `../thunderbird/default.nix` for explanations # on adding `gnupg` and `gpgme` into PATH/LD_LIBRARY_PATH. - installPhase = '' mkdir -p "$prefix/usr/lib/thunderbird-bin-${version}" @@ -135,41 +171,27 @@ stdenv.mkDerivation { ln -s "$prefix/usr/lib/thunderbird-bin-${version}/thunderbird" "$out/bin/" for executable in \ - thunderbird crashreporter thunderbird-bin plugin-container updater + thunderbird thunderbird-bin plugin-container \ + updater crashreporter webapprt-stub do - patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - "$out/usr/lib/thunderbird-bin-${version}/$executable" + if [ -e "$out/usr/lib/thunderbird-bin-${version}/$executable" ]; then + patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + "$out/usr/lib/thunderbird-bin-${version}/$executable" + fi done find . -executable -type f -exec \ patchelf --set-rpath "$libPath" \ "$out/usr/lib/thunderbird-bin-${version}/{}" \; - # Create a desktop item. - mkdir -p $out/share/applications - cat > $out/share/applications/thunderbird.desktop <