NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.31k forks source link

OpenSearch: opensearch-plugin: opensearch-cli: No such file or directory #319323

Open jkxyz opened 5 months ago

jkxyz commented 5 months ago

Describe the bug

It's not currently possible to install plugins with OpenSearch.

With the opensearch and opensearch-cli packages installed, or with services.opensearch.enable = true in my NixOS config, I can't find any way to use the opensearch-plugin command.

Runnning opensearch-plugin in any context produces this error:

/nix/store/mvnkhkg2r37kmjks94zb62rxzj88xrif-opensearch-2.14.0/bin/.opensearch-plugin-wrapped: line 5: /nix/store/mvnkhkg2r37kmjks94zb62rxzj88xrif-opensearch-2.14.0/bin/opensearch-cli: No such file or directory

I've tried borrowing the services.elasticsearch.plugins option and duplicating the esPlugin function found here into a local config. But even in this context the opensearch-plugin executable produces an error.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install the opensearch and opensearch-cli packages or add services.opensearch.enable = true to NixOS config
  2. Run opensearch-plugin

Expected behavior

The program should run without error.

Notify maintainers

@shyim

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.9.3, NixOS, 24.05 (Uakari), 24.05.20240606.9b5328b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos-21.11pre330462.2fa862644fc"`
 - nixpkgs: `/nix/store/x887lkxvgnrrcfgrzz351qhfvvrkm80x-source`

Add a :+1: reaction to issues you find important.

toddmowen commented 2 months ago

Cross-posted from #237057: as a workaround, here is an example of adapting the opensearch derivative to (a) fix the "opensearch-cli: No such file or directory" error, and (b) install several plugins.

  opensearch-with-plugins = nixpkgs.opensearch.overrideAttrs (old: {
    # Workaround for packaging bug (deleting opensearch-cli breaks opensearch-plugin command)
    installPhase = builtins.replaceStrings ["rm $out/bin/opensearch-cli\n"] [""] old.installPhase;

    postInstall = ''
      # Install some plugins
      $out/bin/opensearch-plugin install analysis-icu analysis-smartcn analysis-kuromoji analysis-stempel
    '';
  });
bbenne10 commented 1 month ago

I'm noticing this as well when running opensearch rather than opensearch-plugin. The problem arises from within opensearch-keystore, which attempts to find opensearch-cli in the same directory opensearch-keystore was invoked from.