在不使用shell.nix文件的情况下运行nix-shell时,会弹出以下警告:
$ nix-shell -p glibcLocales
bash: warning: setlocale: LC_TIME: cannot change locale (en_GB.UTF-8): No such file or directory
[nix-shell:~]$如果发现了一些关于将环境变量LOCALE_ARCHIVE_2_27设置为某个路径的帖子。如何将这样的环境变量自动设置为正确的路径?使用一些shell.nix文件会有帮助吗?
编辑:我的地区设置如下:
$ cat /etc/locale.conf
LANG="en_US.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_TIME="en_GB.UTF-8"如果我从/etc/locale.conf中删除LC_TIME="en_GB.UTF-8",即使使用了LC_TIME="en_GB.UTF-8" nix-shell -p glibcLocales,也不会显示警告。
在Fedora 32上使用nix-2.3.6
$ nix-channel --list
发布于 2020-07-28 04:35:08
您可以使用shell.nix中的有效路径填充$LOCALE_ARCHIVE_2_27,如下所示:
❯ cat shell.nix
with import <nixpkgs> {};
mkShell {
LOCALE_ARCHIVE_2_27 = "${glibcLocales}/lib/locale/locale-archive";
buildInputs = [
hello
];
}
❯ nix-shell
[nix-shell:~]$ echo $LOCALE_ARCHIVE_2_27
/nix/store/r24xc904amrdwfrzyijxmylxnxmwacm9-glibc-locales-2.31/lib/locale/locale-archive或将表达式作为参数传递
❯ nix-shell -E 'with import <nixpkgs> { }; runCommand "dummy" { LOCALE_ARCHIVE_2_27 = "${glibcLocales}/lib/locale/locale-archive"; buildInputs = [ hello ]; } ""'
[nix-shell:~]$ echo $LOCALE_ARCHIVE_2_27
/nix/store/r24xc904amrdwfrzyijxmylxnxmwacm9-glibc-locales-2.31/lib/locale/locale-archive更多详细信息请点击此处https://gist.github.com/peti/2c818d6cb49b0b0f2fd7c300f8386bc3
https://stackoverflow.com/questions/62287269
复制相似问题