From f4a07823a298deff0efb0db30f9318511de7c232 Mon Sep 17 00:00:00 2001 From: Heitor Augusto Date: Sat, 22 Feb 2025 04:10:22 -0300 Subject: [PATCH] chromium: add nativeMessagingHosts option (#6019) --- modules/programs/chromium.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index 0a02311b7..2f3b55179 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -137,6 +137,18 @@ let List of ${name} dictionaries to install. ''; }; + nativeMessagingHosts = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression '' + [ + pkgs.kdePackages.plasma-browser-integration + ] + ''; + description = '' + List of ${name} native messaging hosts to install. + ''; + }; }; browserConfig = cfg: @@ -178,6 +190,11 @@ let value.source = pkg; }; + nativeMessagingHostsJoined = pkgs.symlinkJoin { + name = "${drvName}-native-messaging-hosts"; + paths = cfg.nativeMessagingHosts; + }; + package = if cfg.commandLineArgs != [ ] then cfg.package.override { commandLineArgs = concatStringsSep " " cfg.commandLineArgs; @@ -189,7 +206,13 @@ let home.packages = [ package ]; home.file = optionalAttrs (!isProprietaryChrome) (listToAttrs ((map extensionJson cfg.extensions) - ++ (map dictionary cfg.dictionaries))); + ++ (map dictionary cfg.dictionaries)) // { + "${configDir}/NativeMessagingHosts" = { + source = + "${nativeMessagingHostsJoined}/etc/chromium/native-messaging-hosts"; + recursive = true; + }; + }); }; in {