-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add explicit settings for ‘locale’ and ‘locale_archive’ #328
Conversation
Note that the default |
haskell/toolchain.bzl
Outdated
), | ||
"locale_archive": attr.label( | ||
allow_single_file = True, | ||
doc = "Label pointing to the locale archive file to use.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a note that this is nix-specific, or a link to docs?
"locale_archive": attr.label( | ||
allow_single_file = True, | ||
doc = """ | ||
Label pointing to the locale archive file to use. Mostly useful on NixOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it turns out LOCALE_ARCHIVE
is completely nixpkgs specific, not a POSIX thing. They patch glibc to handle that environment variable. Not sure why it's not called NIX_LOCALE_ARCHIVE
but whatever. Given this, it's a shame that we're polluting rules_haskell with Nixpkgs specifc hacks. A better fix long term will be to submit a patch so that the ghc
derivation in Nixpkgs includes a locale archive in its closure.
@Profpatsch thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don’t know. That would be for @peti to decide.
According to glibc
source code it’s normally fixed at configuration time via the COMPLOCALEDIR
option, instead of being a variable path at runtime. I’m not sure why it’s solved with an env var instead of a fix filepath (e.g. /var/lib/locale-archive
) in nixpkgs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure why it’s solved with an env var instead of a fix filepath (e.g.
/var/lib/locale-archive
) in nixpkgs.
That path needs super user privileges to set up and it's system-wide. $LOCALE_ARCHIVE
, on the other hand, can be configured on a per-process basis and needs no privileges to set or unset. See NixOS/nixpkgs#38991 for an example why such concerns may be important.
This PR allows to avoid issues related to reading Unicode text files at compile time. Previously, due to unset locale, locale defaulted to ASCII and reading Unicode text was impossible. This prevented use of e.g. Dhall's TH helpers.