-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
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
nix-shell --pure: non-POSIX locales do not work (by default) #21820
Comments
Having explored a bit more why nixos works i've found this glibc patch:
Basically it provides the following lookup order:
Thus I have my first workaround:
Is it intended search order though? Suppose user will happen to have 2 binaries in env with different glibc versions: 2.11 and 2.24 without glibcLocales depend. There is no single correct LOCALE_ARCHIVE value. To make things more robust it would make sense have a fallback-only env override. Say, in following order:
Then it would be safer to set only Thus my suggestions:
WDYT? |
IMO the point of The package including all theoretically-supported locales is very big, so typically you don't want packages to depend on it (i.e. contain a reference to it). |
One clarification: on non-nixos non-POSIX locales do not work at all unless unless user explicitly specifies LOCALE_ARCHIVE env var (it was my initial source of confusion). Perhaps worth adding it to https://github.com/NixOS/nix/blob/master/scripts/nix-profile.sh.in |
Adding @edolstra to validate if it makes sense to add LOCALE_ARCHIVE to nix-profile.sh |
Yes, that sounds good, at a quick glance, though I'm not certain of the top of my head whether the location for OS locale archive is the same on most distros (or easy to find in the script). |
A lot of python tests fail without this change. |
(triage) Any progress ? It seems like we are awaiting approval from @edolstra. |
Stumbled upon this seeing bad UTF-8 handling by |
also #6878 looks relevant |
Thank you for your contributions. This has been automatically marked as stale because it has had no activity for 180 days. If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity. Here are suggestions that might help resolve this more quickly:
|
From a bit of experience with NixOS I now see that it's somewhat expected for nixpkgs packages not to always work if packages rely on NixOS to provide global variables like locales or runpaths for mesa and friends. Users of nixpkgs without NixOS need to fiddle with environment quite a bit anyway. Locales are not very special here. Closing as INVALID. |
TL;DR: glibcLocales seems to be required for many packages on nix to make localisation work at all
How to add them the nix way?
Issue description
Many nixpkgs lack glibcLocales dependency and as a result are subtly broken
in non-POSIX locale support. It looks like NixOS itself somehow avoids it but
not in sandbox (and not in nix on other OSes).
Steps to reproduce
I am happy user of ru_RU locale. Let's see how it should work first (nixos):
Now how to break it in sandbox:
And fix back:
The problem happens in other packages and tools: glibc, mc
Similar problem happens in nix installed on Gentoo where I did not find away
to teach 'date' how russian locale at all:
Nothing helps. Most desperate attempt was:
I roughly understand why it does not work. My real question is: how to make most tools to see locales?
AFAIU the proper way is to add (optional?) glibcLocales dependency into all the packages:
glibc (for locale), coreutils (for date), mc (for charset collation so editor would be able to work with non-ascii).
Technical details
Thanks!
The text was updated successfully, but these errors were encountered: