diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c17f32..2c44b1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,7 +158,7 @@ jobs: -d "$body" \ https://ntfy.sh/splitleaf - name: Notify failure - if: needs.await-deploy.result == 'failure' + if: needs.await-deploy.result == 'failure' || needs.await-deploy.result == 'skipped' env: SHA: ${{ github.sha }} COMMIT_MSG: ${{ github.event.head_commit.message }} diff --git a/hosts/srv-core/configuration.nix b/hosts/srv-core/configuration.nix index 1f34570..5bdf6fe 100644 --- a/hosts/srv-core/configuration.nix +++ b/hosts/srv-core/configuration.nix @@ -71,6 +71,11 @@ enable = true; domain = "home.${config.custom.networking.overlay.domain}"; }; + + searxng = { + enable = true; + domain = "search.${config.custom.networking.overlay.domain}"; + }; }; }; } diff --git a/modules/home/programs/firefox.nix b/modules/home/programs/firefox.nix index 5097bfe..a342511 100644 --- a/modules/home/programs/firefox.nix +++ b/modules/home/programs/firefox.nix @@ -40,6 +40,16 @@ in |> lib.map (glance: glance.domain) |> lib.head; }; + searchEngine = lib.mkOption { + type = lib.types.nonEmptyStr; + default = + allHosts + |> lib.attrValues + |> lib.map (host: host.config.custom.web-services.searxng) + |> lib.filter (searxng: searxng.enable) + |> lib.map (searxng: searxng.domain) + |> lib.head; + }; extensions = lib.mkOption { type = lib.types.attrsOf ( lib.types.submodule ( @@ -115,6 +125,16 @@ in }; extraConfig = lib.readFile "${inputs.betterfox}/user.js"; + + search = { + force = true; + default = "searxng"; + privateDefault = "searxng"; + engines.searxng = { + name = "searxng"; + urls = lib.singleton { template = "https://${cfg.searchEngine}/search?q={searchTerms}"; }; + }; + }; }; policies.ExtensionSettings = diff --git a/modules/nixos/web-services/glance.nix b/modules/nixos/web-services/glance.nix index a3f2e13..0893c06 100644 --- a/modules/nixos/web-services/glance.nix +++ b/modules/nixos/web-services/glance.nix @@ -87,7 +87,7 @@ in widgets = lib.singleton { type = "search"; - search-engine = "google"; + search-engine = "https://search.splitleaf.de/search?q={QUERY}"; autofocus = true; } ++ applicationSites diff --git a/modules/nixos/web-services/searxng.nix b/modules/nixos/web-services/searxng.nix new file mode 100644 index 0000000..b0ee186 --- /dev/null +++ b/modules/nixos/web-services/searxng.nix @@ -0,0 +1,49 @@ +{ config, lib, ... }: +let + cfg = config.custom.web-services.searxng; +in +{ + options.custom.web-services.searxng = { + enable = lib.mkEnableOption ""; + domain = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + port = lib.mkOption { + type = lib.types.port; + default = 27916; + }; + }; + + config = lib.mkIf cfg.enable { + services.searx = { + enable = true; + settings = { + server = { + inherit (cfg) port; + secret_key = "unnecessary"; + }; + ui.center_alignment = true; + plugins = { + "searx.plugins.calculator.SXNGPlugin".active = true; + "searx.plugins.infinite_scroll.SXNGPlugin".active = true; + "searx.plugins.self_info.SXNGPlugin".active = true; + }; + search = { + autocomplete = "duckduckgo"; + favicon_resolver = "duckduckgo"; + }; + hostnames.remove = [ ''(.*\.)?nixos.wiki'' ]; + }; + }; + + custom = { + services.caddy.virtualHosts.${cfg.domain}.port = cfg.port; + + meta.sites.${cfg.domain} = { + title = "SearXNG"; + icon = "sh:searxng"; + }; + }; + }; +}