Skip to content
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

Rofi installed by home-manager can't set locale #354

Closed
JonathanReeve opened this issue Aug 24, 2018 · 9 comments
Closed

Rofi installed by home-manager can't set locale #354

JonathanReeve opened this issue Aug 24, 2018 · 9 comments

Comments

@JonathanReeve
Copy link
Contributor

JonathanReeve commented Aug 24, 2018

Maybe it's that I don't quite understand how nixos and home-manager are meant to interact, but when I have rofi in my configuration.nix, it works fine, since I'm guessing it uses the system-level LOCALE_ARCHIVE environment variable. But when I enable rofi in home-manager, it installs a new copy of rofi, which apparently can't see (or set?) the system-level LOCALE_ARCHIVE, which on my system is /run/current-system/sw/lib/locale/locale-archive, so it fails with:

(process:12909): Rofi-WARNING **: Failed to set locale.

I'm guessing this also has something to do with glibc-locales versions. See, for instance, this nixos issue.

My workaround, following these other bug reports, is to install glibc-locales to my profile with nix-env -iA nixpkgs.glibc-locales, then run Rofi with that path for LOCALE_ARCHIVE, i.e. env LOCALE_ARCHIVE=$HOME/.nix-profile/lib/locale/locale-archive rofi -show drun.

This is kind of an ugly hack. I'm not sure whether this is a bug, or whether I'm doing something wrong, but it'd be nice for programs installed with home-manager to figure out where the locales they need are. Or maybe have home-manager handle the configuration of Rofi, but detect that it's already installed on the system, and not install a new copy?

Version info:

  • nix-env -q: glibc-locales-2.26-131
  • nix-info: system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.0.4, channels(root): "nixos-18.09pre149415.8395f9aa85e", channels(jon): "nixpkgs-18.03.133086.c1ef96ebdbd", nixpkgs: /home/jon/.nix-defexpr/channels/nixpkgsw
  • nix-info: system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.0.4, channels(root): "nixos", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Edit: debugged some channel problems, hoping that would fix it. Still can't start Rofi; same error.

@JonathanReeve
Copy link
Contributor Author

I have no idea what I'm doing, but could it just be a matter of adding pkgs.glibcLocales to the list of dependencies of rofi in the home-manager module? (I.e. at https://github.com/rycee/home-manager/blob/master/modules/programs/rofi.nix#L306 ?)

@rycee
Copy link
Member

rycee commented Aug 27, 2018

Hmm, yeah I can imagine this being quite annoying. I'm not sure forcing the installation of this on everybody would be a good work-around, though.

It does seem like an issue that is best fixed in Nixpkgs because I assume the same problem would arise if you did nix-env -f '<nixpkgs>' -iA rofi (which is essentially the command Home Manager runs for you to install the package).

I'll have a think about it.

@bsima
Copy link
Contributor

bsima commented Mar 22, 2019

running into this same problem on Debian with home-manager master and Nix 18.09, adding pkgs.glibcLocales to my list of home-manager packages does not seem to fix anything. Does anyone know of a workaround?

@bsima
Copy link
Contributor

bsima commented Mar 22, 2019

This might be relevant? NixOS/nixpkgs#6878

@bsima
Copy link
Contributor

bsima commented Mar 22, 2019

Indeed, doing this at the command line fixes rofi:

export LOCALE_ARCHIVE=$(nix-build '<nixpkgs>' -A glibcLocales)/lib/locale/locale-archive

or, to make it permanent via home-manager:

home.sessionVariables.LOCALES_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";

@aheaume
Copy link
Contributor

aheaume commented Mar 26, 2019

I ran into similar locale issues and found https://gist.github.com/peti/2c818d6cb49b0b0f2fd7c300f8386bc3 which has steps for both nixos and non-nixos.

@pickfire
Copy link
Contributor

pickfire commented Aug 14, 2020

I believe home-manager should error when user set home.language.base = "en-US.UTF-8"; (this should be en_US.UTF-8) but the locale is not built in nix (default is "C" and "POSIX"). That broke my locale configuration and chinese text display and also others applications that require utf-8.

@pickfire
Copy link
Contributor

Only env LANG=C.UTF-8 man man works without warnings and any other locales from system such as en_US.UTF-8 or zh_CN.UTF-8 is broken for man pages, it won't even display zh_CN man pages now. This may be related to this issue I guess?

@stale
Copy link

stale bot commented Apr 29, 2021

Thank you for your contribution! I marked this issue as stale due to inactivity. If this remains inactive for another 7 days, I will close this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

If you have nothing of substance to add, please refrain from commenting and allow the bot close the issue. Also, don't be afraid to manually close an issue, even if it holds valuable information.

Closed issues stay in the system for people to search, read, cross-reference, or even reopen--nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

@stale stale bot added the status: stale label Apr 29, 2021
@stale stale bot closed this as completed May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants