Skip to content

Commit 6dd476b

Browse files
committed
cabal: Honor LOCALE_ARCHIVE settings when building cabal targets
LOCALE_ARCHIVE is a nixpkgs/nixos setting to help glibc find the correct `locale-archive` file. A recent change has made setting this mandatory for newer nixpkgs snapshots. This setting wasn't being honored for `haskell_cabal_library` and `haskell_cabal_binary`. Pass it through for these targets. Also fix `cabal_wrapper.py` to make the path absolute before changing directories.
1 parent 6e31297 commit 6dd476b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

haskell/cabal.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ def _prepare_cabal_inputs(
387387
if extra_ldflags_file:
388388
input_files.append(extra_ldflags_file)
389389

390+
if hs.toolchain.locale_archive:
391+
input_files.append(hs.toolchain.locale_archive)
392+
390393
inputs = depset(
391394
input_files,
392395
transitive = [

haskell/private/cabal_wrapper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ def canonicalize_path(path):
100100
os.environ["RULES_HASKELL_GHC_PKG_PATH"] = canonicalize_path(os.getenv("RULES_HASKELL_GHC_PKG_PATH", ""))
101101
os.environ["RULES_HASKELL_LIBDIR_PATH"] = canonicalize_path(os.getenv("RULES_HASKELL_LIBDIR_PATH", ""))
102102
os.environ["RULES_HASKELL_DOCDIR_PATH"] = canonicalize_path(os.getenv("RULES_HASKELL_DOCDIR_PATH", ""))
103+
if "LOCALE_ARCHIVE" in os.environ:
104+
os.environ["LOCALE_ARCHIVE"] = canonicalize_path(os.getenv("LOCALE_ARCHIVE"))
103105

104106
component = json_args["component"]
105107
name = json_args["pkg_name"]

0 commit comments

Comments
 (0)