I have a (non-nixpkgs) Java application that doesn’t run (seemingly due to not being patched) and I want to package it so that it can run on NixOS. Where do I go looking for how to package it? ELI5.
I want to create a derivation or two, but I’m not sure how and I don’t even really know where to start. I’ve looked at a few of the other topics around here and looked around a bit online, but I feel like I need something even more basic, so please keep that in mind.
Here’s the situation: As a new hire, I recently wanted to try out Enonic XP. They provide a CLI on their Get Started page, which is available either as a binary download or via Snap. It is not available in nixpkgs.
The binary seems to work fine when downloaded. However, the XP application is a Java application that the CLI downloads for you. The CLI can also start, stop, and manage XP for you, but XP is ultimately run (from my understanding) via shell scripts that use a (bundled) Java to run its jar files. This bundled version of Java fails to start. There are more details in this issue on their Discuss page, but the long and short of it is that it seems to fail because the binaries haven’t been patched using patchelf:
Failed to execute process './java'. Reason: The file './java' does not exist or could not be executed.
If I understand correctly, I can get rid of this problem if I package the application for Nix(OS) somehow.
However, I don’t know how to do that or where to start finding out how to do it. I’ve read through the nix-pills series previously and skimmed over the nixpkgs manual today. Is there a more accessible “here’s how you package an application from scratch” guide available anywhere? If not, do you have any tips on how to get started? How do I test whether something works, etc?
I know that I’m asking a lot, but I’m honestly quite lost. Appreciate any and all input! Thanks.
For clarity, it might be worth mentioning that the applications can be found in their source form on their github:
Also added more details to how the two applications interact.