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 let
inherit (flake.config.services) inherit (flake.config.services) instances;
instances inherit (flake.config.machines) devices;
; localhost = instances.web.localhost.address0;
hostname = osConfig.networking.hostName;
in in
{ {
"${instances.jellyfin.label}" = { "${instances.jellyfin.label}" = {
@ -34,7 +35,14 @@ in
icon = ./icons/sx.png; icon = ./icons/sx.png;
urls = [ 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 let
configPath = ./config; configPath = ./config;
flakedPath = configPath + /flake; flakedPath = configPath + /flake;
@ -21,6 +21,7 @@ let
// (import (flakedPath + "/${searchEngine}") { // (import (flakedPath + "/${searchEngine}") {
inherit inherit
flake flake
osConfig
; ;
}) })
) { } (builtins.filter (name: builtins.match ".*\\.nix$" name != null) files); ) { } (builtins.filter (name: builtins.match ".*\\.nix$" name != null) files);
@ -30,20 +31,21 @@ in
{ {
search = { search = {
force = true; force = true;
default = "Brave"; default = "SearXNG";
engines = aggregatedSearchEngines; engines = aggregatedSearchEngines;
order = [ order = [
"AlternativeTo" "AlternativeTo"
"Brave"
"Core Radio" "Core Radio"
"Hackage" "Hackage"
"Hoogle" "Hoogle"
"Jellyfin" "Jellyfin"
"SearXNG"
"Nix Home Manager" "Nix Home Manager"
"Nix Options" "Nix Options"
"Nix Packages" "Nix Packages"
"Nix Wiki" "Nix Wiki"
"PeerTube" "PeerTube"
"SearXNG"
"Sci-Hub" "Sci-Hub"
"Torrent Leech" "Torrent Leech"
"Urban Dictionary" "Urban Dictionary"