branch: elpa/nix-mode
commit aae6f710e044a0fb18186f06728ef7ef228c6f09
Author: yilinwei <[email protected]>
Commit: yilinwei <[email protected]>

    Address review comments
---
 nix-shell.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/nix-shell.el b/nix-shell.el
index ba755db2f7..1a996e3891 100644
--- a/nix-shell.el
+++ b/nix-shell.el
@@ -158,7 +158,14 @@ The DRV file to use."
       (when ld-library-path
        (make-local-variable 'process-environment)
        (setq process-environment
-             (cons (format "LD_LIBRARY_PATH=%s" ld-library-path)
+             (cons
+              (let*
+                  ((var "LD_LIBRARY_PATH")
+                   (current-path (getenv var)))
+                (if current-path
+                    ;; LD_LIBRARY_PATH defined in derivation takes precedence
+                    (format "%s=%s:%s" var ld-library-path current-path)
+                  (format "%s=%s" var ld-library-path)))
                    process-environment)))
 
       (dolist (input inputs)

Reply via email to