Solr has been removed, what are my options?

Hi all,

I am using nix (through devenv) to manage my local development environments.

The stack I have to use for a project includes Solr.

Solr has been removed from Nixpkgs:
https://github.com/NixOS/nixpkgs/pull/221469

What are my options here? Considering…

  1. I am too n00b to propose myself as a maintainer
  2. I use nix just for local development, so I could consider using an insecure version of solr

Thank you

1 Like

You could try the docker version? https://hub.docker.com/_/solr/

The “proper” way:

  1. Revert the commit dropping it
  2. Potentially fix it (might have broke by now?)
  3. Update know vulns (is it still vulnerable?)
  4. Add yourself as maintainer
  5. Submit as PR

You being “too n00b” doesn’t much matter here.
The most important abilities for a maintainer to have are the ability to assert that the package still works after some change and being responsive.
The less important ability is to update the package yourself. That should be fairly easy in most cases as it’s usually an incremental thing; requiring just an update on version and hash. Sometimes it’s more complex but if you’re willing to figure stuff out in order to get it updated, your current experience level is pretty unimportant here. If it took you a day to figure out how to update, you’d still be faster than 90% of us. Don’t stress it.
If you really can’t do that, that’s not too bad either, you’d still be more valuable than 70% of maintainers I come accross (or rather not come across) simply by being responsive. If someone else updates your package and I as a committer come across the PR and see your approval stating that you tested it to be working, I’m merging it (assuming there were no code crimes committed in the diff).

The “easier” way would be to copy the dropped code into a file in your local dev env and pkgs.callPackageing it; vendoring the derivation.

3 Likes

I just finished setting up version 9.3.0 for myself over the weekend. I’m a noob, so I’m sure others might look at it and scratch their heads at some choices I made, but it is functional, as I’m using it to index emails from Dovecot. I’ll see if I can post it somewhere if you want to look at the nix files.

solr.nix

with import <nixpkgs> {};
stdenv.mkDerivation rec {
  pname = "solr";
  version = "9.3.0";

  src = fetchurl {
    url = "mirror://apache/solr/${pname}/${version}/${pname}-${version}-slim.tgz";
    sha256 = "MVbp2L4AWj8VvJSC3ecYHCvrUNeGbMcdkhLb6QT7WwU=";
  };

  nativeBuildInputs = [ makeWrapper ];

  installPhase = ''
    mkdir -p $out $out/bin

    cp -r bin/solr bin/post $out/bin/
    cp -r docs $out/
    cp -r example $out/
    cp -r server $out/

    wrapProgram $out/bin/solr --set JAVA_HOME "${jre}"
    wrapProgram $out/bin/post --set JAVA_HOME "${jre}"
  '';

  meta = with lib; {
    homepage = "https://lucene.apache.org/solr/";
    description = "Open source enterprise search platform from the Apache Lucene project";
    license = licenses.asl20;
    latforms = platforms.all;
    maintainers = with maintainers; [ ];
  };

  }

solr_config.nix

 lib, config, pkgs, ... }:

{
    # Create a user for solr
    users.users.solr = {
      isNormalUser = false;
      isSystemUser = true;
      group = "solr";
    };
    users.groups = {
      solr = { };
    };

    # Solr needs lsof
    environment.systemPackages = with pkgs; [
      lsof
    ];

    environment.etc."default/solr.in.sh".text = ''
    # Increase Java Heap as needed to support your indexing / query needs
    SOLR_HEAP="2048m"

    SOLR_PID_DIR="/var/solr"
    SOLR_HOME="/var/solr/data"
    LOG4J_PROPS="/var/solr/log4j2.xml"
    SOLR_LOGS_DIR="/var/solr/logs"
    SOLR_PORT="8983"
    '';
    # Create directories for storage
    systemd.tmpfiles.rules =
    [
      "d /var/solr 0755 solr solr - -"
      "d /var/solr/data 0755 solr solr - -"
      "d /var/solr/logs 0755 solr solr - -"
      "L /var/solr/data/solr.xml - - - - /etc/solr/solr.xml"
      "L /var/solr/data/zoo.cfg - - - - /etc/solr/zoo.cfg"
      "L /var/solr/log4j2.xml - - - - /etc/solr/log4j2.xml"
    ];

    systemd.services.solr = {
      enable = true;
      description = "Apache Solr";
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = "/run/current-system/sw/bin/solr start -f";
        ExecStop = "/run/current-system/sw/bin/solr stop";
        LimitNOFILE = "65000";
        Environment="PATH=$PATH:/run/current-system/sw/bin";
        User = "solr";
        Group = "solr";
      };
    };
  }