!apXxbtexmNGJaAryzM:nixos.org

NixOS on WSL

343 Members
https://github.com/nix-community/NixOS-WSL60 Servers

Load older messages


SenderMessageTime
25 Nov 2022
@psvo:matrix.orgpsvo(using flakes)16:58:59
@psvo:matrix.orgpsvoi18n.defaultLocale = "en_US.UTF-8";17:03:16
@psvo:matrix.orgpsvo

so, it works for me even in zsh (without any custom setup)

% echo '\u00a0'
 
17:11:22
@k900:0upti.meK900OK I think I found something17:17:29
@k900:0upti.meK900~ ❯ wsl -e /run/current-system/sw/bin/sh -c 'source /etc/set-environment; exec zsh --login' c/Users/me ❯ ~ ❯ wsl -e /run/current-system/sw/bin/zsh --login /home/k900/.zsh/plugins/fzf-tab-completion/zsh/fzf-zsh-completion.sh:4: character not in range c/Users/me ❯17:17:32
@k900:0upti.meK900 So I guess zsh doesn't like it when the environment isn't set up before it starts 17:18:08
@k900:0upti.meK900For some reason17:18:10
@k900:0upti.meK900❯ wsl -e /run/current-system/sw/bin/sh -c 'export LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive; exec /run/current-system/sw/bin/zsh --login'17:20:29
@k900:0upti.meK900And yep it's specifically LOCALE_ARCHIVE17:20:34
@psvo:matrix.orgpsvo

hm, I can replicate this too:

wsl -e /nix/store/xa51hl7d89skwwmv9y3w9wi2lw13cq8v-zsh-5.8.1/bin/zsh --login
nixos% echo '\u00a0'
zsh: character not in range
17:20:43
@k900:0upti.meK900And it works fine in child shells because it's already set globally17:20:56
@k900:0upti.meK900And of course LOCALE_ARCHIVE is not in /init's environment because why would it be17:21:59
@psvo:matrix.orgpsvo
nixos% echo '\u00a0'
zsh: character not in range
nixos% export LC_ALL=en-US.UTF8
nixos% echo '\u00a0'
 
17:23:29
@k900:0upti.meK900And of course it shoves it in a thread local17:23:42
@psvo:matrix.orgpsvothe locale is not UTF817:23:43
@k900:0upti.meK900I'm guessing touching any of the LC_ variables will make it reload the locale from disk17:24:03
@k900:0upti.meK900Thus defeating the point17:24:07
@psvo:matrix.orgpsvo

Well, you can break it even later:

CZsvobodpe02% export LC_ALL=C
CZsvobodpe02% echo '\u00a0'
zsh: character not in range
17:25:11
@k900:0upti.meK900Yeah but that's explicitly setting a non-UTF8 locale17:25:24
@k900:0upti.meK900Oh17:27:12
@k900:0upti.meK900I got it17:27:16
@k900:0upti.meK900I think17:27:24
@k900:0upti.meK900It looks like it's just shoved into the global systemd environment by default17:27:36
@k900:0upti.meK900But somehow that doesn't happen for WSL17:28:29
@k900:0upti.meK900And I think it might be because we're spawning it wrong maybe?17:29:43
@k900:0upti.meK900If this is the fix I am going to mcfuckingloseit17:32:18
@psvo:matrix.orgpsvoI'm not sure I follow - I don't have locale-related env vars in /proc/1/environ17:32:36
@k900:0upti.meK900EXACTLY17:34:38
@psvo:matrix.orgpsvohm, for consideration: I've just switched my default locale cs_CZ.UTF8, but the shell spawned by WSL /init is still having LANG=en_US.UTF-817:38:08
@k900:0upti.meK900Oh no17:38:19

Show newer messages


Back to Room ListRoom Version: 9