flocon/modules/services/searx.nix
Anthony Rodriguez 6ab835555c
treewide: remove home-manager (switch to hjem)
As my NixOS configuration kept growing, I noticed that I don't need
home-manager as much as I did before. A lot of what I need is just a way
to map nix attrsets to the program's respective configuration format,
which is something that I can now do myself, as my nix knowledge got
more extensive. After all of this, I decided to completely get rid of
home-manager, and switch to a simpler solution called hjem, which just
lets me write files to my home directory that are automatically
symlinked using `systemd-tmpfiles`.

This allows me to simplify my configuration, remove the separation
between NixOS and home-manager modules, and cut my eval times by quite a
lot (which allows for faster `nixos-rebuild switch`!).
2025-01-27 23:57:47 +01:00

69 lines
1.9 KiB
Nix

{
inputs,
lib,
pkgs,
config,
...
}: {
imports = [
inputs.agenix.nixosModules.default
];
config = lib.mkIf config.local.profiles.server.enable {
age.secrets.searx-env-file.file = ../../../secrets/searx-env-file.age;
services = {
searx = {
enable = true;
package = pkgs.searxng;
environmentFile = config.age.secrets.searx-env-file.path;
settings = {
search = {
safe_search = 1; # 0 = None, 1 = Moderate, 2 = Strict
autocomplete = "google"; # Existing autocomplete backends: "dbpedia", "duckduckgo", "google", "startpage", "swisscows", "qwant", "wikipedia" - leave blank to turn it off by default
default_lang = "en";
};
server = {
secret_key = "@SEARX_SECRET_KEY@";
port = 8888; # Internal port
bind_address = "localhost"; # Only listen locally
base_url = "https://search.nezia.dev/";
image_proxy = true;
default_http_headers = {
X-Content-Type-Options = "nosniff";
X-XSS-Protection = "1; mode=block";
X-Download-Options = "noopen";
X-Robots-Tag = "noindex, nofollow";
Referrer-Policy = "no-referrer";
};
};
engines = [
{
name = "qwant";
disabled = true;
}
];
};
};
caddy = {
enable = true;
virtualHosts."search.nezia.dev" = {
extraConfig = ''
encode gzip
reverse_proxy localhost:8888 {
header_up Host {host}
header_up X-Real-IP {remote_addr}
header_up X-Forwarded-For {remote_addr}
header_up X-Forwarded-Proto {scheme}
}
'';
};
};
};
# Open required ports
networking.firewall = {
allowedTCPPorts = [80 443]; # For Caddy
};
};
}