firefox: implement native messaging hosts
Fixes #1586 Fixes #1487 Co-authored-by: Carl Hjerpe <git@hjerpe.xyz> Co-authored-by: Robert Helgesson <robert@rycee.net>
This commit is contained in:
parent
e84811035d
commit
6359d40f6e
|
@ -21,6 +21,11 @@ let
|
|||
profilesPath =
|
||||
if isDarwin then "${firefoxConfigPath}/Profiles" else firefoxConfigPath;
|
||||
|
||||
nativeMessagingHostsJoined = pkgs.symlinkJoin {
|
||||
name = "home_ff_nmhs";
|
||||
paths = cfg.package.nativeMessagingHosts or cfg.nativeMessagingHosts;
|
||||
};
|
||||
|
||||
# The extensions path shared by all profiles; will not be supported
|
||||
# by future Firefox versions.
|
||||
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
||||
|
@ -228,6 +233,15 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
nativeMessagingHosts = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Additional packages containing native messaging hosts that should be
|
||||
made available to Firefox extensions.
|
||||
'';
|
||||
};
|
||||
|
||||
finalPackage = mkOption {
|
||||
type = with types; nullOr package;
|
||||
readOnly = true;
|
||||
|
@ -673,7 +687,11 @@ in {
|
|||
will be removed in the future. Please change to overriding the package
|
||||
configuration using 'programs.firefox.package' instead. You can refer to
|
||||
its example for how to do this.
|
||||
'';
|
||||
'' ++ optional (cfg.package.nativeMessagingHosts or null != null
|
||||
&& cfg.nativeMessagingHosts != [ ]) ''
|
||||
Using both 'programs.firefox.package.nativeMessagingHosts' and
|
||||
'programs.firefox.nativeMessagingHosts' is not supported, the latter will be ignored.
|
||||
'';
|
||||
|
||||
programs.firefox.finalPackage = wrapPackage cfg.package;
|
||||
|
||||
|
@ -682,6 +700,8 @@ in {
|
|||
home.file = mkMerge ([{
|
||||
"${firefoxConfigPath}/profiles.ini" =
|
||||
mkIf (cfg.profiles != { }) { text = profilesIni; };
|
||||
"${mozillaConfigPath}/native-messaging-hosts".source =
|
||||
"${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
|
||||
}] ++ flip mapAttrsToList cfg.profiles (_: profile: {
|
||||
"${profilesPath}/${profile.path}/.keep".text = "";
|
||||
|
||||
|
|
Loading…
Reference in a new issue