Infinidoge / nix-minecraft

An attempt to better support Minecraft-related content for the Nix ecosystem
MIT License
172 stars 18 forks source link

Feature Request: Allow adding to server PATH #50

Closed Silverdev2482 closed 3 months ago

Silverdev2482 commented 7 months ago

I ran across a mod called Fastback which I want to use to make backups on my server. According to the developer it finds git in the $PATH, but I assume, probably because nixos trying to keep things pure it prevents certian applications from accessing the path, but I could be wrong. It uses git and native git is faster that the java implementation of it. in certain operations git is 35 times faster. Because of this I believe there should be a way for mods to use native programs. I also wonder if there should be a way for mods to use native libraries or can take advantage of them, I do not know if any mods do this however nor do I have examples. I have a few 3 ideas for solutions but I'm not sure if they would work.

  1. Simply have an option where mods can access the path. I assume this isn't pure and this seems like a hack but it would work.
  2. Have an option to install packages that would be accessible to the mods but other programs wouldn't be accessible to the mods. Seems like a good option but It doesn't solve libraries
  3. Have a method of packaging mods for nix. This doesn't seem like a good option for various reasons but if a few mods that require native libraries exist they could be packaged like this

Personally I would say do 1 or 2 and if mods that do require native libraries exist do 3, although that requires a lot of work.

Infinidoge commented 7 months ago

The reason why it can't find it in PATH is because the PATH for the service you are running the server in doesn't include it. (systemd services, by design, are isolated from the user's path).

This is less a mod-side feature request, and more so a request to be able to add things to a server's systemd service path.

With regards to your 3 ideas:

  1. Mods can already access the PATH, it's just that the PATH they can access isn't the one you are expecting.
  2. Is also already the case, it just (currently) isn't possible to add to that server's PATH, which is something I could fix
  3. Isn't actually a bad idea, (And technically, is already being done, just in a very basic 'download a file' way.) it would just be quite verbose if you needed to write a whole derivation for every mod. If I add support for getting native programs from mod derivations, I'd add a helper to make it less verbose, and just have you put in the native programs yourself.