feat: added host logic for searx

This commit is contained in:
Nick 2025-04-01 21:52:03 -05:00
parent 7e98c1daa2
commit f33a8eb669
2 changed files with 18 additions and 8 deletions

View file

@ -1,8 +1,9 @@
{ flake, ... }:
{ flake, osConfig, ... }:
let
inherit (flake.config.services)
instances
;
inherit (flake.config.services) instances;
inherit (flake.config.machines) devices;
localhost = instances.web.localhost.address0;
hostname = osConfig.networking.hostName;
in
{
"${instances.jellyfin.label}" = {
@ -34,7 +35,14 @@ in
icon = ./icons/sx.png;
urls = [
{
template = "https://${instances.searx.subdomain}.${instances.web.domains.url0}/search?q={searchTerms}";
template =
(
if hostname == devices.mars.name then
"http://${localhost}:${toString instances.searx.ports.port0}"
else
"https://${instances.searx.subdomain}.${instances.web.domains.url0}"
)
+ "/search?q={searchTerms}";
}
];
};

View file

@ -1,4 +1,4 @@
{ flake, ... }:
{ flake, osConfig, ... }:
let
configPath = ./config;
flakedPath = configPath + /flake;
@ -21,6 +21,7 @@ let
// (import (flakedPath + "/${searchEngine}") {
inherit
flake
osConfig
;
})
) { } (builtins.filter (name: builtins.match ".*\\.nix$" name != null) files);
@ -30,20 +31,21 @@ in
{
search = {
force = true;
default = "Brave";
default = "SearXNG";
engines = aggregatedSearchEngines;
order = [
"AlternativeTo"
"Brave"
"Core Radio"
"Hackage"
"Hoogle"
"Jellyfin"
"SearXNG"
"Nix Home Manager"
"Nix Options"
"Nix Packages"
"Nix Wiki"
"PeerTube"
"SearXNG"
"Sci-Hub"
"Torrent Leech"
"Urban Dictionary"