MarginaliaSearch
Marginalia Search is an experimental search engine focused on the independent web, designed to run on low-cost hardware. Its development aims to improve search quality, expand coverage, automate operations, and provide portable data to support related search projects.
This project is funded by NLnet through these subgrants:
Options
services.marginalia-search
- services.marginalia-search.dbPropertiesFile
-
Path at runtime to a Java .properties file with sensitive settings for
/conf/db.properties. For an example, look at run/install/db.properties.template in marginalia-search's src.
- Type:
string
- Default:
""
- services.marginalia-search.enable
-
Whether to enable Marginalia Search, a search engine for a more human, non-commercial internet .
- Type:
boolean
- Default:
false
- services.marginalia-search.systemProperties
-
Settings that belong in
/conf/properties/system.properties - Type:
attribute set
- Default:
{ "blacklist.disable" = "false"; "control.hideMarginaliaApp" = "false"; "converter.sideloadThreshold" = "10000"; "crawler.poolSize" = "256"; "crawler.userAgentIdentifier" = "GoogleBot"; "crawler.userAgentString" = "Mozilla/5.0 (compatible)"; "executor.uploadDir" = "/uploads"; "flyway.disable" = "false"; "ip-blocklist.disabled" = "false"; "log4j2.configurationFile" = "log4j2-test.xml"; "search.websiteUrl" = "http://localhost:8080"; "storage.root" = "/var/lib/marginalia-search/index-1"; zookeeper-hosts = "localhost:2181"; }
Examples
A basic configuration of a MySQL database, Zookeeper, and Marginalia.
This configuration will allow opening the control panel at .
Insecure practices are used here to make testing easy.
For production usage, look into secrets management via Nix.
{ config, pkgs, ... }: let dbUser = "marginalia"; # The way the password is used here, and how files that depend on it get generated & put into the store, is... # ! NOT SECURE ! # ... For production usage, look into secrets management via Nix. dbPassword = "foobar"; # This is hardcoded in marginalia dbTable = "WMSA_prod"; in { services.mysql = { enable = true; package = pkgs.mariadb; ensureDatabases = [ dbTable ]; settings = { mysqld = { bind-address = "127.0.0.1"; port = "3306"; }; mariadb = { plugin_load_add = "auth_ed25519"; }; }; # ensureUsers sets wrong password type, we need simple password login # The way the password is used here, and how files that depend on it get generated & put into the store, is... # ! NOT SECURE ! # ... For production usage, look into secrets management via Nix. initialScript = pkgs.writeText "initial-mariadb-script" '' CREATE USER IF NOT EXISTS '${dbUser}'@'localhost' IDENTIFIED WITH ed25519; ALTER USER '${dbUser}'@'localhost' IDENTIFIED BY '${dbPassword}'; GRANT ALL PRIVILEGES ON ${dbTable}.* TO '${dbUser}'@'localhost'; ''; }; services.zookeeper = { enable = true; port = 2181; }; services.marginalia-search = { enable = true; systemProperties = { "crawler.userAgentString" = "Mozilla/5.0 (compatible)"; "crawler.userAgentIdentifier" = "GoogleBot"; "crawler.poolSize" = "256"; "log4j2.configurationFile" = "log4j2-test.xml"; "search.websiteUrl" = "http://localhost:8080"; "executor.uploadDir" = "/uploads"; "converter.sideloadThreshold" = "10000"; "ip-blocklist.disabled" = "false"; "blacklist.disable" = "false"; "flyway.disable" = "false"; "control.hideMarginaliaApp" = "false"; "zookeeper-hosts" = "localhost:${toString config.services.zookeeper.port}"; "storage.root" = "/var/lib/marginalia-search/index-1"; }; # The way the password is used here, and how files that depend on it get generated & put into the store, is... # ! NOT SECURE ! # ... For production usage, look into secrets management via Nix. dbPropertiesFile = "${(pkgs.formats.javaProperties { }).generate "db.properties" { "db.user" = "${dbUser}"; "db.pass" = "${dbPassword}"; "db.conn" = "jdbc:mariadb://${config.services.mysql.settings.mysqld.bind-address}:${toString config.services.mysql.settings.mysqld.port}/${dbTable}?rewriteBatchedStatements=true"; }}"; }; }