firefox/wrapper: clean up plugin related code

This commit is contained in:
Dominik Xaver Hörl 2021-02-09 09:11:44 +01:00
parent a073dd54aa
commit ac2e3ef270

View file

@ -51,27 +51,6 @@ let
alsaSupport = browser.alsaSupport or false; alsaSupport = browser.alsaSupport or false;
pipewireSupport = browser.pipewireSupport or false; pipewireSupport = browser.pipewireSupport or false;
# FIXME: This should probably be an assertion now?
plugins =
let
removed = lib.filter (a: builtins.hasAttr a cfg) [
"enableAdobeFlash"
"enableAdobeReader"
"enableBluejeans"
"enableDjvu"
"enableFriBIDPlugin"
"enableGoogleTalkPlugin"
"enableMPlayer"
"enableVLC"
"icedtea"
"jre"
];
in if removed != [] then
throw "Your configuration mentions ${lib.concatMapStringsSep ", " (p: browserName + "." + p) removed}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins)."
else
[]
;
nativeMessagingHosts = nativeMessagingHosts =
([ ] ([ ]
++ lib.optional (cfg.enableBrowserpass or false) (lib.getBin browserpass) ++ lib.optional (cfg.enableBrowserpass or false) (lib.getBin browserpass)
@ -164,7 +143,24 @@ let
# # # #
############################# #############################
in stdenv.mkDerivation { # TODO: remove this after the next release (21.03)
configPlugins = lib.filter (a: builtins.hasAttr a cfg) [
"enableAdobeFlash"
"enableAdobeReader"
"enableBluejeans"
"enableDjvu"
"enableFriBIDPlugin"
"enableGoogleTalkPlugin"
"enableMPlayer"
"enableVLC"
"icedtea"
"jre"
];
pluginsError =
"Your configuration mentions ${lib.concatMapStringsSep ", " (p: browserName + "." + p) configPlugins}. All plugin related options have been removed, since Firefox from version 52 onwards no longer supports npapi plugins (see https://support.mozilla.org/en-US/kb/npapi-plugins).";
in if configPlugins != [] then throw pluginsError else
(stdenv.mkDerivation {
inherit pname version; inherit pname version;
desktopItem = makeDesktopItem { desktopItem = makeDesktopItem {
@ -262,12 +258,9 @@ let
makeWrapper "$oldExe" \ makeWrapper "$oldExe" \
"$out${browser.execdir or "/bin"}/${browserName}${nameSuffix}" \ "$out${browser.execdir or "/bin"}/${browserName}${nameSuffix}" \
--suffix-each MOZ_PLUGIN_PATH ':' "$plugins" \
--suffix LD_LIBRARY_PATH ':' "$libs" \ --suffix LD_LIBRARY_PATH ':' "$libs" \
--suffix-each GTK_PATH ':' "$gtk_modules" \ --suffix-each GTK_PATH ':' "$gtk_modules" \
--suffix-each LD_PRELOAD ':' "$(cat $(filterExisting $(addSuffix /extra-ld-preload $plugins)))" \
--prefix PATH ':' "${xdg-utils}/bin" \ --prefix PATH ':' "${xdg-utils}/bin" \
--prefix-contents PATH ':' "$(filterExisting $(addSuffix /extra-bin-path $plugins))" \
--suffix PATH ':' "$out${browser.execdir or "/bin"}" \ --suffix PATH ':' "$out${browser.execdir or "/bin"}" \
--set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \ --set MOZ_APP_LAUNCHER "${browserName}${nameSuffix}" \
--set MOZ_SYSTEM_DIR "$out/lib/mozilla" \ --set MOZ_SYSTEM_DIR "$out/lib/mozilla" \
@ -351,9 +344,6 @@ let
preferLocalBuild = true; preferLocalBuild = true;
# Let each plugin tell us (through its `mozillaPlugin') attribute
# where to find the plugin in its tree.
plugins = map (x: x + x.mozillaPlugin) plugins;
libs = lib.makeLibraryPath libs + ":" + lib.makeSearchPathOutput "lib" "lib64" libs; libs = lib.makeLibraryPath libs + ":" + lib.makeSearchPathOutput "lib" "lib64" libs;
gtk_modules = map (x: x + x.gtkModule) gtk_modules; gtk_modules = map (x: x + x.gtkModule) gtk_modules;
@ -362,14 +352,9 @@ let
disallowedRequisites = [ stdenv.cc ]; disallowedRequisites = [ stdenv.cc ];
meta = browser.meta // { meta = browser.meta // {
description = description = browser.meta.description;
browser.meta.description
+ " (with plugins: "
+ lib.concatStrings (lib.intersperse ", " (map (x: x.name) plugins))
+ ")";
hydraPlatforms = []; hydraPlatforms = [];
priority = (browser.meta.priority or 0) - 1; # prefer wrapper over the package priority = (browser.meta.priority or 0) - 1; # prefer wrapper over the package
}; };
}; });
in in lib.makeOverridable wrapper
lib.makeOverridable wrapper