Unverified Commit f610b720 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

whoogle-search: init at 0.9.0, add module (#350730)

parents 06534987 1cf79681
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@

- [Bat](https://github.com/sharkdp/bat), a {manpage}`cat(1)` clone with wings. Available as [programs.bat](options.html#opt-programs.bat).

- [Whoogle Search](https://github.com/benbusby/whoogle-search), a self-hosted, ad-free, privacy-respecting metasearch engine. Available as [services.whoogle-search](options.html#opt-services.whoogle-search.enable).

- [agorakit](https://github.com/agorakit/agorakit), an organization tool for citizens' collectives. Available with [services.agorakit](options.html#opt-services.agorakit.enable).

- [waagent](https://github.com/Azure/WALinuxAgent), the Microsoft Azure Linux Agent (waagent) manages Linux provisioning and VM interaction with the Azure Fabric Controller. Available with [services.waagent](options.html#opt-services.waagent.enable).
+1 −0
Original line number Diff line number Diff line
@@ -1291,6 +1291,7 @@
  ./services/networking/websockify.nix
  ./services/networking/wg-access-server.nix
  ./services/networking/wg-netmanager.nix
  ./services/networking/whoogle-search.nix
  ./services/networking/wvdial.nix
  ./services/networking/webhook.nix
  ./services/networking/wg-quick.nix
+70 −0
Original line number Diff line number Diff line
{
  config,
  lib,
  pkgs,
  ...
}:

let
  cfg = config.services.whoogle-search;
in
{
  options = {
    services.whoogle-search = {
      enable = lib.mkEnableOption "Whoogle, a metasearch engine";

      port = lib.mkOption {
        type = lib.types.port;
        default = 5000;
        description = "Port to listen on.";
      };

      listenAddress = lib.mkOption {
        type = lib.types.str;
        default = "127.0.0.1";
        description = "Address to listen on for the web interface.";
      };

      extraEnv = lib.mkOption {
        type = with lib.types; attrsOf str;
        default = { };
        description = ''
          Extra environment variables to pass to Whoogle, see
          https://github.com/benbusby/whoogle-search?tab=readme-ov-file#environment-variables
        '';
      };
    };
  };

  config = lib.mkIf cfg.enable {

    systemd.services.whoogle-search = {
      description = "Whoogle Search";
      wantedBy = [ "multi-user.target" ];
      path = [ pkgs.whoogle-search ];

      environment = {
        CONFIG_VOLUME = "/var/lib/whoogle-search";
      } // cfg.extraEnv;

      serviceConfig = {
        Type = "simple";
        ExecStart =
          "${lib.getExe pkgs.whoogle-search}"
          + " --host '${cfg.listenAddress}'"
          + " --port '${builtins.toString cfg.port}'";
        ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
        StateDirectory = "whoogle-search";
        StateDirectoryMode = "0750";
        DynamicUser = true;
        PrivateTmp = true;
        ProtectSystem = true;
        ProtectHome = true;
        Restart = "on-failure";
        RestartSec = "5s";
      };
    };

    meta.maintainers = with lib.maintainers; [ malte-v ];
  };
}
+1 −0
Original line number Diff line number Diff line
@@ -1149,6 +1149,7 @@ in {
  webhook = runTest ./webhook.nix;
  weblate = handleTest ./web-apps/weblate.nix {};
  whisparr = handleTest ./whisparr.nix {};
  whoogle-search = handleTest ./whoogle-search.nix {};
  wiki-js = handleTest ./wiki-js.nix {};
  wine = handleTest ./wine.nix {};
  wireguard = handleTest ./wireguard {};
+24 −0
Original line number Diff line number Diff line
import ./make-test-python.nix (
  { pkgs, lib, ... }:
  {
    name = "whoogle-search";
    meta.maintainers = with lib.maintainers; [ malte-v ];

    nodes.machine =
      { pkgs, ... }:
      {
        services.whoogle-search = {
          enable = true;
          port = 5000;
          listenAddress = "127.0.0.1";
        };
      };

    testScript = ''
      machine.start()
      machine.wait_for_unit("whoogle-search.service")
      machine.wait_for_open_port(5000)
      machine.wait_until_succeeds("curl --fail --show-error --silent --location localhost:5000/")
    '';
  }
)
Loading