{ config, options, lib, pkgs, ... }: let firefoxConf = config.modules.desktop.apps.browsers.firefox; arkenfox = { owner = "arkenfox"; repo = "user.js"; version = "117.0"; }; in { options.modules.desktop.apps.browsers.firefox = { enable = lib.mkOption { type = lib.types.bool; default = false; }; }; config = lib.mkIf (firefoxConf.enable) { env.MOZ_DBUS_REMOTE = "1"; home.packages = [pkgs.xdg-utils]; home.manager.programs.firefox = { enable = true; package = pkgs.firefox; profiles."default" = { extraConfig = builtins.readFile ( builtins.fetchTarball { url = "https://github.com/${arkenfox.owner}/${arkenfox.repo}/archive/refs/tags/${arkenfox.version}.tar.gz"; sha256="1pll4fbdn2390n05902l3pkg4rizxghkakpzi1r9z1b7blmk1x4s"; } + "/user.js"); search = { force = true; default = "DuckDuckGo"; engines = { "Nix Packages" = { urls = [{ template = "https://search.nixos.org/packages"; params = [ { name = "type"; value = "packages"; } { name = "query"; value = "{searchTerms}"; } ]; }]; definedAliases = [ "@np" ]; }; "NixOS Wiki" = { urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; iconUpdateURL = "https://nixos.wiki/favicon.png"; updateInterval = 24 * 60 * 60 * 1000; definedAliases = [ "@nw" ]; }; }; }; }; }; modules.desktop.defaultApplications.apps.browser = rec { package = pkgs.firefox; install = false; cmd = "${package}/bin/firefox"; desktop = "firefox"; }; }; }