From 9faed6a8389fb51b57a0e1a95444d35b02e756dc Mon Sep 17 00:00:00 2001 From: cydparser Date: Wed, 2 Aug 2023 21:36:30 -0700 Subject: [PATCH 1/2] Fix direnv error when LD_LIBRARY_PATH is initially unset --- ghc.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc.nix b/ghc.nix index 59b7d13..c656606 100644 --- a/ghc.nix +++ b/ghc.nix @@ -264,7 +264,7 @@ hspkgs.shellFor rec { # "nix-shell --pure" resets LANG to POSIX, this breaks "make TAGS". export LANG="en_US.UTF-8" - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${lib.makeLibraryPath depsSystem}" + export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${lib.makeLibraryPath depsSystem}" unset LD ${lib.optionalString withDocs "export FONTCONFIG_FILE=${fonts}"} From a36ec633ae793425c76f5f076e4f8ee112478e66 Mon Sep 17 00:00:00 2001 From: cydparser Date: Sun, 6 Aug 2023 13:37:22 -0700 Subject: [PATCH 2/2] Include `libstdc++` in `LD_LIBRARY_PATH` --- ghc.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ghc.nix b/ghc.nix index c656606..f477c07 100644 --- a/ghc.nix +++ b/ghc.nix @@ -240,6 +240,8 @@ hspkgs.shellFor rec { "--target=${crossTarget}" ]; + LD_LIBRARY_PATH = "${stdenv.cc.cc.lib}/lib:${lib.makeLibraryPath depsSystem}"; + shellHook = '' # somehow, CC gets overridden so we set it again here. export CC=${stdenv.cc}/bin/cc @@ -264,7 +266,6 @@ hspkgs.shellFor rec { # "nix-shell --pure" resets LANG to POSIX, this breaks "make TAGS". export LANG="en_US.UTF-8" - export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH:+''${LD_LIBRARY_PATH}:}${lib.makeLibraryPath depsSystem}" unset LD ${lib.optionalString withDocs "export FONTCONFIG_FILE=${fonts}"}