mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
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
1 changed files with 21 additions and 1 deletions
|
@ -21,6 +21,11 @@ let
|
||||||
profilesPath =
|
profilesPath =
|
||||||
if isDarwin then "${firefoxConfigPath}/Profiles" else firefoxConfigPath;
|
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
|
# The extensions path shared by all profiles; will not be supported
|
||||||
# by future Firefox versions.
|
# by future Firefox versions.
|
||||||
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
|
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 {
|
finalPackage = mkOption {
|
||||||
type = with types; nullOr package;
|
type = with types; nullOr package;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
|
@ -673,6 +687,10 @@ in {
|
||||||
will be removed in the future. Please change to overriding the package
|
will be removed in the future. Please change to overriding the package
|
||||||
configuration using 'programs.firefox.package' instead. You can refer to
|
configuration using 'programs.firefox.package' instead. You can refer to
|
||||||
its example for how to do this.
|
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;
|
programs.firefox.finalPackage = wrapPackage cfg.package;
|
||||||
|
@ -682,6 +700,8 @@ in {
|
||||||
home.file = mkMerge ([{
|
home.file = mkMerge ([{
|
||||||
"${firefoxConfigPath}/profiles.ini" =
|
"${firefoxConfigPath}/profiles.ini" =
|
||||||
mkIf (cfg.profiles != { }) { text = profilesIni; };
|
mkIf (cfg.profiles != { }) { text = profilesIni; };
|
||||||
|
"${mozillaConfigPath}/native-messaging-hosts".source =
|
||||||
|
"${nativeMessagingHostsJoined}/lib/mozilla/native-messaging-hosts";
|
||||||
}] ++ flip mapAttrsToList cfg.profiles (_: profile: {
|
}] ++ flip mapAttrsToList cfg.profiles (_: profile: {
|
||||||
"${profilesPath}/${profile.path}/.keep".text = "";
|
"${profilesPath}/${profile.path}/.keep".text = "";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue