nixpkgs/nixos/modules/services/networking/whoogle-search.nix
NAHO a2ed7e8d88
nixos: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --exclude doc/manual/release-notes \
      --type file \
      . \
      nixos \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2026-01-15 16:07:55 +01:00

71 lines
1.7 KiB
Nix

{
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 '${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 ];
}