From 81af972cca0ec1a0987b161ec0ee0e91282ef3e6 Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 22 Nov 2025 00:38:45 -0600 Subject: [PATCH] feat: fixed opensearch and elasticsearch --- modules/nixos/guests/mastodon/default.nix | 28 +++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/nixos/guests/mastodon/default.nix b/modules/nixos/guests/mastodon/default.nix index f0a3f76..24334f9 100755 --- a/modules/nixos/guests/mastodon/default.nix +++ b/modules/nixos/guests/mastodon/default.nix @@ -322,9 +322,33 @@ in }; mastodon-init-db.serviceConfig.EnvironmentFile = "/var/lib/mastodon/.secrets_env"; - systemd-tmpfiles-setup.after = [ "var-lib-mastodon.mount" ]; - }; + systemd-tmpfiles-setup.after = [ "var-lib-mastodon.mount" ]; + + opensearch-install-plugins = { + description = "Install OpenSearch plugins"; + before = [ "opensearch.service" ]; + requiredBy = [ "opensearch.service" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + }; + script = '' + PLUGIN_DIR="/var/lib/opensearch/plugins/analysis-icu" + if [ ! -d "$PLUGIN_DIR" ]; then + # Create the plugins directory if it doesn't exist + mkdir -p /var/lib/opensearch/plugins + + # Install using the proper OpenSearch plugin command + export OPENSEARCH_JAVA_HOME="${pkgs.jdk17}/lib/openjdk" + ${pkgs.opensearch}/bin/opensearch-plugin install --batch analysis-icu || { + echo "Plugin installation failed, but continuing anyway" + exit 0 + } + fi + ''; + }; + }; timers.fedifetcher = { description = "Timer for FediFetcher"; wantedBy = [ "timers.target" ];