modules/nixos: add more search engines

This commit is contained in:
Dmitriy Pleshevskiy 2024-04-18 18:18:53 +03:00
parent 96f4239510
commit 70d3eb824c
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
4 changed files with 24 additions and 6 deletions

View file

@ -9,6 +9,7 @@ let
withPassffAddon = isPassEnabled; withPassffAddon = isPassEnabled;
withRedirectorAddon = true; withRedirectorAddon = true;
withSidebarTabsAddon = true; withSidebarTabsAddon = true;
withAllSearchEngines = true;
}; };
librewolf' = with pkgs.unstable; librewolf.override { librewolf' = with pkgs.unstable; librewolf.override {

View file

@ -7,6 +7,7 @@ let
firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}"; firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}";
withRedirectorAddon = true; withRedirectorAddon = true;
withSidebarTabsAddon = true; withSidebarTabsAddon = true;
withAllSearchEngines = true;
}; };
mullvadBrowser = pkgs.mullvad-browser.overrideAttrs (attrs: { mullvadBrowser = pkgs.mullvad-browser.overrideAttrs (attrs: {

View file

@ -2,7 +2,8 @@
, withPassffAddon ? false , withPassffAddon ? false
, withRedirectorAddon ? false , withRedirectorAddon ? false
, withSidebarTabsAddon ? false , withSidebarTabsAddon ? false
, firefoxAddons , withAllSearchEngines ? false
, firefoxAddons ? { }
, lib , lib
, writeText , writeText
, ... , ...
@ -33,6 +34,7 @@ writeText "policies.json" (builtins.toJSON {
IconURL = "https://search.sapti.me/static/themes/simple/img/favicon.png"; IconURL = "https://search.sapti.me/static/themes/simple/img/favicon.png";
URLTemplate = "https://search.sapti.me/search?q={searchTerms}"; URLTemplate = "https://search.sapti.me/search?q={searchTerms}";
} }
] ++ lib.optionals withAllSearchEngines [
{ {
Alias = "np"; Alias = "np";
Name = "NixOS Packages"; Name = "NixOS Packages";
@ -47,6 +49,23 @@ writeText "policies.json" (builtins.toJSON {
IconURL = "https://nixos.org/favicon.png"; IconURL = "https://nixos.org/favicon.png";
URLTemplate = "https://search.nixos.org/options?query={searchTerms}"; 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"; Default = "SearXNG";
Remove = [ Remove = [

View file

@ -1,11 +1,9 @@
{ config, pkgs, lib, inputs, ... }: { config, pkgs, lib, ... }:
let let
cfg = config.local.programs.browsers.tor-browser; cfg = config.local.programs.browsers.tor-browser;
policiesJson = pkgs.callPackage ./policies.nix { policiesJson = pkgs.callPackage ./policies.nix { };
firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}";
};
torBrowser = (pkgs.tor-browser-bundle-bin.override { torBrowser = (pkgs.tor-browser-bundle-bin.override {
mediaSupport = true; mediaSupport = true;
@ -13,7 +11,6 @@ let
}).overrideAttrs (attrs: { }).overrideAttrs (attrs: {
postInstall = '' postInstall = ''
rm $out/share/tor-browser/distribution/policies.json rm $out/share/tor-browser/distribution/policies.json
install -Dvm644 ${policiesJson} $out/share/tor-browser/distribution/policies.json install -Dvm644 ${policiesJson} $out/share/tor-browser/distribution/policies.json
''; '';
}); });