Bug with Git when LD_LIBRARY_PATH env variable set in Nix

Problem description:
The Git extension provides the following error if I in replit.nix I have the env variable LD_LIBRARY_PATH set to a value

Git error: There was an unrecognized fatal error with Git. This is probably a bug in the app.

Replit.nix:

{ pkgs }: {
	deps = [
		pkgs.nodejs-18_x
    pkgs.nodePackages.typescript-language-server
    pkgs.yarn
    pkgs.replitPackages.jest
    pkgs.openssl_1_1
	];
  env = { 
    LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.openssl_1_1.out ]; 
  };
}

Expected behavior:
Expected Git to continue working

Actual behavior:
Git fails and logs the error provided.

Steps to reproduce:
Specify environment variable in replit.nix shown.

Bug appears at this link:

Browser:
OS: Macos Ventura 13.4.1
Device (Android, iOS, n/a leave blank): Mac
Plan (Free, Hacker, Pro Plan):
Pro

I imagine that the fact that you have to manually set LD_LIBRARY_PATH instead of just adding to the deps shows that Nix is trying to prevent unwanted breakages caused by adding openssl.
Instead, set PRYBAR_LD_LIBRARY_PATH in replit.nix, and, in .replit file, add this in the interpreter.command section.

env = { LD_LIBRARY_PATH = "$PRYBAR_LD_LIBRARY_PATH" }

Then, it’ll only be in the library path for the program, where it’s needed.

1 Like

I’m having the same issue. I tried this, but my .replit doesn’t have an interpreter.command section so I needed to create it myself, and when I try to run the repl it just gets stuck on “interpret”. My understanding based on the documentation is that, by setting anything in the interpreter section, I’m overriding my original run command, meaning that my repl just isn’t running anything. I looked at a few repls which do use the interpreter section already and found that they have an “args” section with a command, so I tried putting my run command there args = ["vite", "dev", "--host"] but had the same result. I also tried putting the LD_LIBRARY_PATH = "$DEFINITION_DASH_LD_LIBRARY_PATH" in the actual [env] section of the .replit file, which allowed my app to access OpenSSL, but still prevented Git from working. Any ideas what I’m doing wrong?

set this to

run = 'LD_LIBRARY_PATH+=":$REPLIT_LD_LIBRARY_PATH" # rest of command line...'

Or replace the REPLIT_ prefix to match what you’ve set in replit.nix, but with that prefix, soon you won’t have to change the run command like this (as long as your config is set to use Nix modules)

Thank you! Good to know this seems to be a thing the repl.it developers are looking in to based on that GitHub issue!