firefox: add handlers.json configuration

Adds support for configuring Firefox's handlers.json file to
manage MIME type and URL scheme handlers declaratively (at
`programs.firefox.profiles.<profile>.handlers`). Handlers control
how Firefox opens files and protocols (e.g., PDF viewers,
`mailto:` handlers).
This commit is contained in:
André Kugland 2026-02-13 18:40:30 -03:00 committed by Austin Horstman
parent c9507a9aa5
commit a913ae61bf
6 changed files with 364 additions and 0 deletions

View file

@ -548,6 +548,25 @@ in
description = "Declarative search engine configuration.";
};
handlers = mkOption {
type = types.submodule (
args:
import ./profiles/handlers.nix {
inherit (args) config;
inherit lib pkgs appName;
package = cfg.finalPackage;
modulePath = modulePath ++ [
"profiles"
name
"handlers"
];
profilePath = config.path;
}
);
default = { };
description = "Declarative handlers configuration for MIME types and URL schemes.";
};
containersForce = mkOption {
type = types.bool;
default = false;
@ -1048,6 +1067,11 @@ in
source = profile.search.file;
};
"${cfg.profilesPath}/${profile.path}/handlers.json" = mkIf (profile.handlers.enable) {
source = profile.handlers.configFile;
force = profile.handlers.force;
};
"${cfg.profilesPath}/${profile.path}/extensions" = mkIf (profile.extensions.packages != [ ]) {
source =
let