firefox: start killing all the per-extension options
This commit is contained in:
parent
c92fb2994f
commit
60421a1622
5 changed files with 92 additions and 54 deletions
|
@ -27,6 +27,6 @@ with lib;
|
||||||
"opt/brave/native-messaging-hosts/${appId}".source = source "hosts/chromium";
|
"opt/brave/native-messaging-hosts/${appId}".source = source "hosts/chromium";
|
||||||
"opt/brave/policies/managed/${appId}".source = source "policies/chromium";
|
"opt/brave/policies/managed/${appId}".source = source "policies/chromium";
|
||||||
};
|
};
|
||||||
programs.firefox.wrapperConfig.enableBrowserpass = true;
|
programs.firefox.nativeMessagingHosts.packages = [ pkgs.browserpass ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ with lib;
|
||||||
let
|
let
|
||||||
cfg = config.programs.firefox;
|
cfg = config.programs.firefox;
|
||||||
|
|
||||||
nmh = cfg.nativeMessagingHosts;
|
|
||||||
|
|
||||||
policyFormat = pkgs.formats.json { };
|
policyFormat = pkgs.formats.json { };
|
||||||
|
|
||||||
organisationInfo = ''
|
organisationInfo = ''
|
||||||
|
@ -17,6 +15,50 @@ let
|
||||||
given control of your browser, unless of course they also control your
|
given control of your browser, unless of course they also control your
|
||||||
NixOS configuration.
|
NixOS configuration.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# deprecated per-native-messaging-host options
|
||||||
|
nmhOptions = {
|
||||||
|
browserpass = {
|
||||||
|
name = "Browserpass";
|
||||||
|
package = pkgs.browserpass;
|
||||||
|
};
|
||||||
|
bukubrow = {
|
||||||
|
name = "Bukubrow";
|
||||||
|
package = pkgs.bukubrow;
|
||||||
|
};
|
||||||
|
euwebid = {
|
||||||
|
name = "Web eID";
|
||||||
|
package = pkgs.web-eid-app;
|
||||||
|
};
|
||||||
|
ff2mpv = {
|
||||||
|
name = "ff2mpv";
|
||||||
|
package = pkgs.ff2mpv;
|
||||||
|
};
|
||||||
|
fxCast = {
|
||||||
|
name = "fx_cast";
|
||||||
|
package = pkgs.fx-cast-bridge;
|
||||||
|
};
|
||||||
|
gsconnect = {
|
||||||
|
name = "GSConnect";
|
||||||
|
package = pkgs.gnomeExtensions.gsconnect;
|
||||||
|
};
|
||||||
|
jabref = {
|
||||||
|
name = "JabRef";
|
||||||
|
package = pkgs.jabref;
|
||||||
|
};
|
||||||
|
passff = {
|
||||||
|
name = "PassFF";
|
||||||
|
package = pkgs.passff-host;
|
||||||
|
};
|
||||||
|
tridactyl = {
|
||||||
|
name = "Tridactyl";
|
||||||
|
package = pkgs.tridactyl-native;
|
||||||
|
};
|
||||||
|
ugetIntegrator = {
|
||||||
|
name = "Uget Integrator";
|
||||||
|
package = pkgs.uget-integrator;
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.programs.firefox = {
|
options.programs.firefox = {
|
||||||
|
@ -204,46 +246,31 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeMessagingHosts = mapAttrs (_: v: mkEnableOption (mdDoc v)) {
|
nativeMessagingHosts = ({
|
||||||
browserpass = "Browserpass support";
|
packages = mkOption {
|
||||||
bukubrow = "Bukubrow support";
|
type = types.listOf types.package;
|
||||||
euwebid = "Web eID support";
|
default = [];
|
||||||
ff2mpv = "ff2mpv support";
|
description = mdDoc ''
|
||||||
fxCast = "fx_cast support";
|
Additional packages containing native messaging hosts that should be made available to Firefox extensions.
|
||||||
gsconnect = "GSConnect support";
|
'';
|
||||||
jabref = "JabRef support";
|
};
|
||||||
passff = "PassFF support";
|
}) // (mapAttrs (k: v: mkEnableOption (mdDoc "${v.name} support")) nmhOptions);
|
||||||
tridactyl = "Tridactyl support";
|
|
||||||
ugetIntegrator = "Uget Integrator support";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = let
|
||||||
|
forEachEnabledNmh = fn: flatten (mapAttrsToList (k: v: lib.optional cfg.nativeMessagingHosts.${k} (fn k v)) nmhOptions);
|
||||||
|
in mkIf cfg.enable {
|
||||||
|
warnings = forEachEnabledNmh (k: v:
|
||||||
|
"The `programs.firefox.nativeMessagingHosts.${k}` option is deprecated, " +
|
||||||
|
"please add `${v.package.pname}` to `programs.firefox.nativeMessagingHosts.packages` instead."
|
||||||
|
);
|
||||||
|
programs.firefox.nativeMessagingHosts.packages = forEachEnabledNmh (_: v: v.package);
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
(cfg.package.override (old: {
|
(cfg.package.override (old: {
|
||||||
extraPrefs = cfg.autoConfig;
|
extraPrefsFiles = old.extraPrefsFiles or [] ++ [(pkgs.writeText "firefox-autoconfig.js" cfg.autoConfig)];
|
||||||
extraNativeMessagingHosts =
|
nativeMessagingHosts = old.nativeMessagingHosts or [] ++ cfg.nativeMessagingHosts.packages;
|
||||||
old.extraNativeMessagingHosts or []
|
cfg = (old.cfg or {}) // cfg.wrapperConfig;
|
||||||
++ optional nmh.ff2mpv pkgs.ff2mpv
|
|
||||||
++ optional nmh.euwebid pkgs.web-eid-app
|
|
||||||
++ optional nmh.gsconnect pkgs.gnomeExtensions.gsconnect
|
|
||||||
++ optional nmh.jabref pkgs.jabref
|
|
||||||
++ optional nmh.passff pkgs.passff-host;
|
|
||||||
cfg = let
|
|
||||||
# copy-pasted from the wrapper; TODO: figure out fix
|
|
||||||
applicationName = cfg.package.binaryName or (lib.getName cfg.package);
|
|
||||||
|
|
||||||
oldCfg = old.cfg or {};
|
|
||||||
nixpkgsConfig = pkgs.config.${applicationName} or {};
|
|
||||||
optionConfig = cfg.wrapperConfig;
|
|
||||||
nmhConfig = {
|
|
||||||
enableBrowserpass = nmh.browserpass;
|
|
||||||
enableBukubrow = nmh.bukubrow;
|
|
||||||
enableTridactylNative = nmh.tridactyl;
|
|
||||||
enableUgetIntegrator = nmh.ugetIntegrator;
|
|
||||||
enableFXCastBridge = nmh.fxCast;
|
|
||||||
};
|
|
||||||
in oldCfg // nixpkgsConfig // optionConfig // nmhConfig;
|
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,6 @@ in
|
||||||
|
|
||||||
services.dbus.packages = [ pkgs.gnome-browser-connector ];
|
services.dbus.packages = [ pkgs.gnome-browser-connector ];
|
||||||
|
|
||||||
programs.firefox.wrapperConfig.enableGnomeExtensions = true;
|
programs.firefox.nativeMessagingHosts.packages = [ pkgs.gnome-browser-connector ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,7 +379,7 @@ in
|
||||||
# Update the start menu for each user that is currently logged in
|
# Update the start menu for each user that is currently logged in
|
||||||
system.userActivationScripts.plasmaSetup = activationScript;
|
system.userActivationScripts.plasmaSetup = activationScript;
|
||||||
|
|
||||||
programs.firefox.wrapperConfig.enablePlasmaBrowserIntegration = true;
|
programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ];
|
||||||
})
|
})
|
||||||
|
|
||||||
(mkIf (cfg.kwinrc != {}) {
|
(mkIf (cfg.kwinrc != {}) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ let
|
||||||
, nameSuffix ? ""
|
, nameSuffix ? ""
|
||||||
, icon ? applicationName
|
, icon ? applicationName
|
||||||
, wmClass ? applicationName
|
, wmClass ? applicationName
|
||||||
|
, nativeMessagingHosts ? []
|
||||||
, extraNativeMessagingHosts ? []
|
, extraNativeMessagingHosts ? []
|
||||||
, pkcs11Modules ? []
|
, pkcs11Modules ? []
|
||||||
, useGlvnd ? true
|
, useGlvnd ? true
|
||||||
|
@ -62,18 +63,28 @@ let
|
||||||
# PCSC-Lite daemon (services.pcscd) also must be enabled for firefox to access smartcards
|
# PCSC-Lite daemon (services.pcscd) also must be enabled for firefox to access smartcards
|
||||||
smartcardSupport = cfg.smartcardSupport or false;
|
smartcardSupport = cfg.smartcardSupport or false;
|
||||||
|
|
||||||
nativeMessagingHosts =
|
deprecatedNativeMessagingHost = option: pkg:
|
||||||
[ ]
|
if (cfg.${option} or false)
|
||||||
++ lib.optional (cfg.enableBrowserpass or false) (lib.getBin browserpass)
|
then
|
||||||
++ lib.optional (cfg.enableBukubrow or false) bukubrow
|
lib.warn "The cfg.${option} argument for `firefox.override` is deprecated, please add `pkgs.${pkg.pname}` to `nativeMessagingHosts` instead"
|
||||||
++ lib.optional (cfg.enableTridactylNative or false) tridactyl-native
|
[pkg]
|
||||||
++ lib.optional (cfg.enableGnomeExtensions or false) gnome-browser-connector
|
else [];
|
||||||
++ lib.optional (cfg.enableUgetIntegrator or false) uget-integrator
|
|
||||||
++ lib.optional (cfg.enablePlasmaBrowserIntegration or false) plasma5Packages.plasma-browser-integration
|
allNativeMessagingHosts = builtins.map lib.getBin (
|
||||||
++ lib.optional (cfg.enableFXCastBridge or false) fx-cast-bridge
|
nativeMessagingHosts
|
||||||
++ lib.optional (cfg.enableKeePassXC or false) keepassxc
|
++ deprecatedNativeMessagingHost "enableBrowserpass" browserpass
|
||||||
++ extraNativeMessagingHosts
|
++ deprecatedNativeMessagingHost "enableBukubrow" bukubrow
|
||||||
;
|
++ deprecatedNativeMessagingHost "enableTridactylNative" tridactyl-native
|
||||||
|
++ deprecatedNativeMessagingHost "enableGnomeExtensions" gnome-browser-connector
|
||||||
|
++ deprecatedNativeMessagingHost "enableUgetIntegrator" uget-integrator
|
||||||
|
++ deprecatedNativeMessagingHost "enablePlasmaBrowserIntegration" plasma5Packages.plasma-browser-integration
|
||||||
|
++ deprecatedNativeMessagingHost "enableFXCastBridge" fx-cast-bridge
|
||||||
|
++ deprecatedNativeMessagingHost "enableKeePassXC" keepassxc
|
||||||
|
++ (if extraNativeMessagingHosts != []
|
||||||
|
then lib.warn "The extraNativeMessagingHosts argument for the Firefox wrapper is deprecated, please use `nativeMessagingHosts`" extraNativeMessagingHosts
|
||||||
|
else [])
|
||||||
|
);
|
||||||
|
|
||||||
libs = lib.optionals stdenv.isLinux [ udev libva mesa libnotify xorg.libXScrnSaver cups pciutils ]
|
libs = lib.optionals stdenv.isLinux [ udev libva mesa libnotify xorg.libXScrnSaver cups pciutils ]
|
||||||
++ lib.optional pipewireSupport pipewire
|
++ lib.optional pipewireSupport pipewire
|
||||||
++ lib.optional ffmpegSupport ffmpeg_5
|
++ lib.optional ffmpegSupport ffmpeg_5
|
||||||
|
@ -338,7 +349,7 @@ let
|
||||||
install -D -t $out/share/applications $desktopItem/share/applications/*
|
install -D -t $out/share/applications $desktopItem/share/applications/*
|
||||||
|
|
||||||
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
mkdir -p $out/lib/mozilla/native-messaging-hosts
|
||||||
for ext in ${toString nativeMessagingHosts}; do
|
for ext in ${toString allNativeMessagingHosts}; do
|
||||||
ln -sLt $out/lib/mozilla/native-messaging-hosts $ext/lib/mozilla/native-messaging-hosts/*
|
ln -sLt $out/lib/mozilla/native-messaging-hosts $ext/lib/mozilla/native-messaging-hosts/*
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue