Open hajdamak opened 5 years ago
Which font do you use? Does it have powerline glyphs?
Yes it has. Hack NerdFont Mono: https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/Hack/Regular/complete/Hack%20Regular%20Nerd%20Font%20Complete%20Mono.ttf
I have tested it in Alacritty and Gnome Terminal.
On the same setup Fish displays symbols correctly when executed directly from Ubuntu, Junest or from Linuxbrew.
Could this be a locale issue?
Highly likely. I had similar issue in Junest: https://github.com/fsquillace/junest/issues/217 . However it was simply fixed by changing locale settings. In nix such simple fix does not seem to work.
This issue looks a lot like https://github.com/NixOS/nixpkgs/issues/38991, but the workaround, setting LOCALE_ARCHIVE differently, doesn't seem to work.
New versions of fish
don't print any information about what the locale gets set to in their debug output, but older ones do. On my affected systems, Fish from nixpkgs 18.03 (2.7.1) prints this output at --debug-level 2
:
$ fish --debug-level 2
<2> fish: exec_path: '/nix/store/1648ydgjfh5dm6j14wxl08s04ksfn8f3-fish-2.7.1/bin/fish'
<2> fish: determine_config_directory_paths() results:
paths.data: /nix/store/1648ydgjfh5dm6j14wxl08s04ksfn8f3-fish-2.7.1/share/fish
paths.sysconf: /nix/store/1648ydgjfh5dm6j14wxl08s04ksfn8f3-fish-2.7.1/etc/fish
paths.doc: /nix/store/1648ydgjfh5dm6j14wxl08s04ksfn8f3-fish-2.7.1/share/doc/fish
paths.bin: /nix/store/1648ydgjfh5dm6j14wxl08s04ksfn8f3-fish-2.7.1/bin
<2> fish: locale var LANG='en_US.UTF-8'
<2> fish: locale var LANGUAGE=''
<2> fish: locale var LC_ALL=''
<2> fish: locale var LC_ADDRESS=''
<2> fish: locale var LC_COLLATE=''
<2> fish: locale var LC_CTYPE=''
<2> fish: locale var LC_IDENTIFICATION=''
<2> fish: locale var LC_MEASUREMENT=''
<2> fish: locale var LC_MESSAGES=''
<2> fish: locale var LC_MONETARY=''
<2> fish: locale var LC_NAME=''
<2> fish: locale var LC_NUMERIC=''
<2> fish: locale var LC_PAPER=''
<2> fish: locale var LC_TELEPHONE=''
<2> fish: locale var LC_TIME=''
<2> fish: init_locale() setlocale(): '(null)'
So I guess there's a problem with the locale information fish
is getting from glibc
, but it's not the archive version incompatibility crap, because the glibc versions on my NixOS system (which doesn't exhibit this issue) and on my Ubuntu system (which does) are the same. :-\
Oops, I'm a goof. It is glibc
failing to find the locale archives, although I'm not exactly sure where it's going wrong. And current versions of fish
do tell you about what locale info they're getting from glibc
, but at --debug-level 5
:
? ~ ? fish --debug-level 5 -c exit ^| grep setlocale
<5> fish: init_locale() setlocale(): '(null)'
This means there are at least three workarounds:
locale-archive
fileNote that this will only work if the locale-archive
on the distro is in a format compatible with Nixpkgs' glibc
; compatibility may break between versions of glibc
.
? ~ ? env LOCALE_ARCHIVE=/usr/lib/locale/locale-archive fish --debug-level 5 -c exit ^| grep setlocale
<5> fish: init_locale() setlocale(): 'en_US.UTF-8'
locale-archive
file from NixpkgsThis will always work, but it's a >100MB download.
? ~ ? env "LOCALE_ARCHIVE="(nix-build --no-out-link '<nixpkgs>' -A glibcLocales)"/lib/locale/locale-archive" fish --debug-level 5 -c exit ^| grep setlocale
<5> fish: init_locale() setlocale(): 'en_US.UTF-8'
This will always work, but you can't actually use the locale you want.
? ~ ? env LANG=C.UTF-8 fish --debug-level 5 -c exit ^| grep setlocale
<5> fish: init_locale() setlocale(): 'C.UTF-8'
@therealpxc Thank's a lot for your solutions. Workaround 2 solved the problem on my side.
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:
Issue description
Fish themes that use Powerlines symbols (like Bob the fish) displays ? instead of proper Powerline symbols.
Steps to reproduce
Technical details
"x86_64-linux"
Linux 4.4.0-141-generic, Ubuntu, 16.04.5 LTS (Xenial Xerus)
no
no
nix-env (Nix) 2.2.1
"nixpkgs-19.03pre166740.422b6bd489a"
/home/rafalh/.nix-defexpr/channels/nixpkgs