1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +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:
Ujp8LfXBJ6wCPR 2024-01-24 23:22:57 +01:00 committed by GitHub
parent e84811035d
commit 6359d40f6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,6 +687,10 @@ 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 = "";