Cannot get SearxNG to work

Hi, I am a beginner of NixOS, using the stable 23.05 channel, installed inside QEMU virtual machine.
I have been playing with it for just a few days.
I am going to install searxng, but I can never get it to work.
The corresponding config in configuration.nix are as follow:

services = {
  searx = {
    enable = true;
    package = pkgs.searxng;
    runInUwsgi = true;
    uwsgiConfig = {
      disable-logging = true;
      http = ":8888";
      socket = "/run/searx/searx.sock";
      chmod-socket = "666";
    };
  };
};

After I typed localhost:8888 in the browser URL, it just kept loading for a couple of minutes and eventually failed.

This is the output of sudo lsof -nP -iTCP -sTCP:LISTEN

COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
uwsgi   1046 searx    3u  IPv4  15191      0t0  TCP *:8888 (LISTEN)
uwsgi   1051 searx    3u  IPv4  15191      0t0  TCP *:8888 (LISTEN)

Seems the services are running properly in the background.

I found out that the searxng I was using is the version 2023-05-09
So I want to give the unstable one a shot.

I have these line in the very beginning of the configuration.nix to get the unstable packages:

{ config, pkgs, lib, ... }:
let
 unstable = import <nixos-unstable> {};
in {

However, I cannot get the unstable searxng by services.searx.package = pkgs.unstable.searxng;, it just prompt some error: attribute 'unstable' missing
Putting the unstable.searxng inside environment.systemPackages = with pkgs; [ ] seems just install it but not using it as a service.

I am now stuck here and don’t know what to do.
Please help! Thanks!

Before you try unstable, give this config a try. Your didn’t need to use the uwsgi option for a single user install. This is my searx.nix file:

{
  pkgs,
  ...
}:{
  environment.systemPackages = with pkgs; [
    searxng
  ];
  services.searx = {
    enable = true;
    settings = {
      server = {
        port = 8888;
        bind_address = "127.0.0.1";
        secret_key = "secret key";
      };
    };
  };
}
2 Likes

It is working now, Thanks!

1 Like

please mark the question as solved! thanks!