summaryrefslogtreecommitdiff
path: root/modules/root/searxng.nix
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-08-19 21:26:36 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-08-19 21:26:36 -0500
commit95f86e629a073e3a8c473e2acd5f8b648413c68b (patch)
tree5989bc3843627dad5df6ff21b286efb77055b7cf /modules/root/searxng.nix
parent168eb276e6e16f377a8f5759d380f27d4b3d5b24 (diff)
downloadnixos-95f86e629a073e3a8c473e2acd5f8b648413c68b.tar.xz
nixos-95f86e629a073e3a8c473e2acd5f8b648413c68b.zip
move web services to services and expose web socket for searxng
Diffstat (limited to 'modules/root/searxng.nix')
-rw-r--r--modules/root/searxng.nix109
1 files changed, 0 insertions, 109 deletions
diff --git a/modules/root/searxng.nix b/modules/root/searxng.nix
deleted file mode 100644
index 9f59314..0000000
--- a/modules/root/searxng.nix
+++ /dev/null
@@ -1,109 +0,0 @@
-{ pkgs, lib, config, ... }: let
- environmentFile = "/run/searx/searxng.env";
- generateEnvironmentFile = ''
- umask 077
- echo "SEARXNG_SECRET=$(head -c 56 /dev/urandom | base64)" > ${environmentFile}
- ls /run/searx
- '';
-in {
- options = {
- searxng.enable = lib.mkEnableOption "enables searxng service";
- };
-
- config = lib.mkIf config.searxng.enable {
- # Generate secret key
- systemd.services.searx-environment-file = {
- description = "Generate environment file with secret key for searx";
- wantedBy = [ "searx-init.service" ];
- partOf = [ "searx-init.service" ];
- before = [ "searx-init.service" ];
- serviceConfig = {
- Type = "oneshot";
- RemainAfterExit = true;
- User = "searx";
- RuntimeDirectory = "searx";
- RuntimeDirectoryMode = "750";
- ConditionPathExists = "!${environmentFile}";
- };
- script = generateEnvironmentFile;
- };
-
- # Configure searxng
- services.searx = {
- enable = true;
- redisCreateLocally = true;
- package = pkgs.searxng;
- inherit environmentFile; # Provides secret key
-
- settings = {
- general = {
- instance_name = "TJK Search";
- donation_url = "https://tjkeller.xyz";
- enable_metrics = false;
- };
-
- # Search engine settings
- search = {
- safe_search = 2; # Strict
- autocomplete = "";
- default_lang = "en-US";
- };
-
- preferences.lock = [ "safesearch" ]; # Lock safe_search at strict
-
- # https://docs.searxng.org/admin/plugins.html
- enabled_plugins = [
- "Tor check plugin"
- "Tracker URL remover"
- "Basic Calculator"
- "Unit converter plugin"
- "Hash plugin"
- "Self Information"
- "Open Access DOI rewrite"
- "Hostnames plugin"
- ];
-
- hostnames.replace = {
- "(.*\.)?youtube\.com$" = "piped.tjkeller.xyz";
- "(.*\.)?youtu\.be$" = "piped.tjkeller.xyz";
- "(.*\.)?reddit\.com$" = "old.reddit.com";
- };
-
- # Enable / disabled search engines from default list
- engines = lib.mapAttrsToList (name: value: { inherit name; disabled = !value; }) {
- # Images
- "artic" = false;
- "deviantart" = false;
- "flickr" = false;
- "library of congress" = false;
- "openverse" = false;
- "pinterest" = false;
- "public domain image archive" = false;
- "unsplash" = false;
- "wallhaven" = false;
- "wikicommons.images" = false;
-
- # Videos
- "bitchute" = true;
- "dailymotion" = false;
- "piped" = false;
- "rumble" = true;
- "sepiasearch" = false;
- "vimeo" = false;
- "wikicommons.videos" = false;
-
- # Music
- "piped.music" = false;
-
- # Files
- "1337x" = true;
- "annas archive" = true;
- "library genesis" = true;
-
- # Apps
- "fdroid" = true;
- };
- };
- };
- };
-}