diff --git a/home/programs/browsers/firefox/default.nix b/home/programs/browsers/firefox/default.nix index 9d6b688..9f72f13 100644 --- a/home/programs/browsers/firefox/default.nix +++ b/home/programs/browsers/firefox/default.nix @@ -1,10 +1,12 @@ { - inputs, pkgs, lib, config, ... }: { + imports = [ + ./search-engines.nix + ]; xdg.configFile."tridactyl/tridactylrc" = { text = '' unbind @@ -46,102 +48,6 @@ meta = {}; }) ]; - bookmarks = {}; - search = { - force = true; - default = "Brave"; - order = [ - "Brave" - "Google" - "DuckDuckGo" - ]; - engines = let - inherit (lib.attrsets) attrsToList; - inherit (lib.lists) singleton; - in { - "Home Manager" = { - urls = singleton { - template = "https://home-manager-options.extranix.com"; - params = attrsToList { - query = "{searchTerms}"; - release = "master"; - }; - }; - iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png"; - definedAliases = ["@hm"]; - }; - "Nix Packages" = { - urls = singleton { - template = "https://search.nixos.org/packages"; - params = attrsToList { - query = "{searchTerms}"; - channel = "unstable"; - }; - }; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = ["@np"]; - }; - "NixOS Options" = { - urls = singleton { - template = "https://search.nixos.org/options"; - params = attrsToList { - query = "{searchTerms}"; - channel = "unstable"; - }; - }; - icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; - definedAliases = ["@no"]; - }; - "GitHub" = { - urls = singleton { - template = "https://github.com/search"; - params = attrsToList { - q = "{searchTerms}"; - type = "code"; - }; - }; - iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; - definedAliases = ["@gh"]; - }; - "GitHub Repos" = { - urls = singleton { - template = "https://github.com/search"; - params = attrsToList { - q = "{searchTerms}"; - type = "repositories"; - }; - }; - iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; - definedAliases = ["@ghr"]; - }; - "GitHub Nix" = { - urls = singleton { - template = "https://github.com/search"; - params = attrsToList { - "q" = "lang:nix {searchTerms}"; - "type" = "code"; - }; - }; - iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; - definedAliases = ["@ghn"]; - }; - "Brave" = { - urls = singleton { - template = "https://search.brave.com/search"; - params = attrsToList { - "q" = "{searchTerms}"; - }; - }; - iconUpdateURL = "https://brave.com/static-assets/images/brave-favicon.png"; - definedAliases = ["@b"]; - }; - - "Google".metaData.alias = "@go"; - "DuckDuckGo".metaData.alias = "@ddg"; - "Wikipedia".metaData.alias = "@wiki"; - "Bing".metaData.hidden = true; - }; - }; userChrome = builtins.readFile ./userChrome.css; settings = { "browser.display.use_system_colors" = true; # about:blank colour match colourscheme diff --git a/home/programs/browsers/firefox/search-engines.nix b/home/programs/browsers/firefox/search-engines.nix new file mode 100644 index 0000000..c2b4a7e --- /dev/null +++ b/home/programs/browsers/firefox/search-engines.nix @@ -0,0 +1,101 @@ +{ + lib, + pkgs, + ... +}: { + programs.firefox.profiles.xun.search = let + inherit (lib) attrsToList singleton; + in { + force = true; + default = "Brave"; + order = [ + "Brave" + "Google" + "DuckDuckGo" + ]; + + engines = { + "Home Manager" = { + urls = singleton { + template = "https://home-manager-options.extranix.com"; + params = attrsToList { + query = "{searchTerms}"; + release = "master"; + }; + }; + iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png"; + definedAliases = ["@hm"]; + }; + "Nix Packages" = { + urls = singleton { + template = "https://search.nixos.org/packages"; + params = attrsToList { + query = "{searchTerms}"; + channel = "unstable"; + }; + }; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + "NixOS Options" = { + urls = singleton { + template = "https://search.nixos.org/options"; + params = attrsToList { + query = "{searchTerms}"; + channel = "unstable"; + }; + }; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@no"]; + }; + "GitHub" = { + urls = singleton { + template = "https://github.com/search"; + params = attrsToList { + q = "{searchTerms}"; + type = "code"; + }; + }; + iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; + definedAliases = ["@gh"]; + }; + "GitHub Repos" = { + urls = singleton { + template = "https://github.com/search"; + params = attrsToList { + q = "{searchTerms}"; + type = "repositories"; + }; + }; + iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; + definedAliases = ["@ghr"]; + }; + "GitHub Nix" = { + urls = singleton { + template = "https://github.com/search"; + params = attrsToList { + "q" = "lang:nix {searchTerms}"; + "type" = "code"; + }; + }; + iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg"; + definedAliases = ["@ghn"]; + }; + "Brave" = { + urls = singleton { + template = "https://search.brave.com/search"; + params = attrsToList { + "q" = "{searchTerms}"; + }; + }; + iconUpdateURL = "https://brave.com/static-assets/images/brave-favicon.png"; + definedAliases = ["@b"]; + }; + + "Google".metaData.alias = "@go"; + "DuckDuckGo".metaData.alias = "@ddg"; + "Wikipedia".metaData.alias = "@wiki"; + "Bing".metaData.hidden = true; + }; + }; +}