From 70d3eb824c003a2ae625a08e1f40a0aeb07e1228 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Thu, 18 Apr 2024 18:18:53 +0300 Subject: [PATCH] modules/nixos: add more search engines --- modules/nixos/programs/browsers/librewolf.nix | 1 + .../programs/browsers/mullvad-browser.nix | 1 + modules/nixos/programs/browsers/policies.nix | 21 ++++++++++++++++++- .../nixos/programs/browsers/tor-browser.nix | 7 ++----- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/modules/nixos/programs/browsers/librewolf.nix b/modules/nixos/programs/browsers/librewolf.nix index 1764ef3..2b7ee40 100644 --- a/modules/nixos/programs/browsers/librewolf.nix +++ b/modules/nixos/programs/browsers/librewolf.nix @@ -9,6 +9,7 @@ let withPassffAddon = isPassEnabled; withRedirectorAddon = true; withSidebarTabsAddon = true; + withAllSearchEngines = true; }; librewolf' = with pkgs.unstable; librewolf.override { diff --git a/modules/nixos/programs/browsers/mullvad-browser.nix b/modules/nixos/programs/browsers/mullvad-browser.nix index 3139143..b85b053 100644 --- a/modules/nixos/programs/browsers/mullvad-browser.nix +++ b/modules/nixos/programs/browsers/mullvad-browser.nix @@ -7,6 +7,7 @@ let firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}"; withRedirectorAddon = true; withSidebarTabsAddon = true; + withAllSearchEngines = true; }; mullvadBrowser = pkgs.mullvad-browser.overrideAttrs (attrs: { diff --git a/modules/nixos/programs/browsers/policies.nix b/modules/nixos/programs/browsers/policies.nix index da5a4fe..96ac5a3 100644 --- a/modules/nixos/programs/browsers/policies.nix +++ b/modules/nixos/programs/browsers/policies.nix @@ -2,7 +2,8 @@ , withPassffAddon ? false , withRedirectorAddon ? false , withSidebarTabsAddon ? false -, firefoxAddons +, withAllSearchEngines ? false +, firefoxAddons ? { } , lib , writeText , ... @@ -33,6 +34,7 @@ writeText "policies.json" (builtins.toJSON { IconURL = "https://search.sapti.me/static/themes/simple/img/favicon.png"; URLTemplate = "https://search.sapti.me/search?q={searchTerms}"; } + ] ++ lib.optionals withAllSearchEngines [ { Alias = "np"; Name = "NixOS Packages"; @@ -47,6 +49,23 @@ writeText "policies.json" (builtins.toJSON { IconURL = "https://nixos.org/favicon.png"; URLTemplate = "https://search.nixos.org/options?query={searchTerms}"; } + { + Alias = "ng"; + Name = "Noogle"; + Description = "Search for nix functions by name."; + IconURL = "https://noogle.dev/favicon.png"; + URLTemplate = "https://noogle.dev/q?term={searchTerms}"; + } + { + Alias = "hg"; + Name = "Hoogle"; + Description = '' + Hoogle is a Haskell API search engine, which allows you to + search many standard Haskell libraries by either function name, + or by approximate type signature.''; + URLTemplate = "https://hoogle.haskell.org/?hoogle={searchTerms}"; + IconURL = "https://hoogle.haskell.org/favicon64.png"; + } ]; Default = "SearXNG"; Remove = [ diff --git a/modules/nixos/programs/browsers/tor-browser.nix b/modules/nixos/programs/browsers/tor-browser.nix index 9470a5e..ba79f2e 100644 --- a/modules/nixos/programs/browsers/tor-browser.nix +++ b/modules/nixos/programs/browsers/tor-browser.nix @@ -1,11 +1,9 @@ -{ config, pkgs, lib, inputs, ... }: +{ config, pkgs, lib, ... }: let cfg = config.local.programs.browsers.tor-browser; - policiesJson = pkgs.callPackage ./policies.nix { - firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}"; - }; + policiesJson = pkgs.callPackage ./policies.nix { }; torBrowser = (pkgs.tor-browser-bundle-bin.override { mediaSupport = true; @@ -13,7 +11,6 @@ let }).overrideAttrs (attrs: { postInstall = '' rm $out/share/tor-browser/distribution/policies.json - install -Dvm644 ${policiesJson} $out/share/tor-browser/distribution/policies.json ''; });