{ flake, osConfig, ... }:
let
  inherit (flake.config.services) instances;
  inherit (flake.config.machines) devices;
  localhost = instances.web.localhost.address0;
  hostname = osConfig.networking.hostName;
in
{
  "${instances.jellyfin.label}" = {
    definedAliases = [
      "@jf"
    ];
    icon = ./icons/jf.png;
    urls = [
      {
        template = "https://${instances.jellyfin.subdomain}.${instances.web.domains.url0}/web/#/search.html?query={searchTerms}";
      }
    ];
  };
  "${instances.searx.label}" = {
    definedAliases = [
      "@sx"
    ];
    icon = ./icons/sx.png;
    urls = [
      {
        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}";
      }
    ];
  };
}
