From 7805db09740c12f914a078be65856863c3b965f3 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sun, 20 Oct 2024 22:31:02 +0900 Subject: [PATCH] Adjust locale setting especially to fix Tofu in VT * Prefer Eglish for system default * Ensure ASCII in Linux VT console * Prefer ISO 8601 date format with en_DK hack --- home-manager/bash.nix | 1 + home-manager/common.nix | 7 +++++++ home-manager/zsh.nix | 1 + nixos/configuration.nix | 15 ++------------- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/home-manager/bash.nix b/home-manager/bash.nix index ba014eaa..bc56c5dc 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -135,6 +135,7 @@ source "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then + export LANG=C # Avoid Tofu disable_blinking_cursor fi '' diff --git a/home-manager/common.nix b/home-manager/common.nix index b8fbddd0..b3e99268 100644 --- a/home-manager/common.nix +++ b/home-manager/common.nix @@ -79,6 +79,13 @@ inherit edge-pkgs; inherit homemade-pkgs; }; + + # https://wiki.archlinux.jp/index.php/%E3%83%AD%E3%82%B1%E3%83%BC%E3%83%AB + # https://github.com/nix-community/home-manager/blob/fe56302339bb28e3471632379d733547caec8103/modules/home-environment.nix#L11 + language = { + base = "ja_JP.UTF-8"; + time = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale + }; }; # Let Home Manager install and manage itself. diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 99291a46..3c2d842d 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -292,6 +292,7 @@ in source_sh "${homemade-pkgs.posix_shared_functions}" if [ 'linux' = "$TERM" ]; then + export LANG=C # Avoid Tofu disable_blinking_cursor fi diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 75c99b20..38377c79 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -168,21 +168,10 @@ }; }; - # TODO: Reconsider to set C or EN for servers - # Select internationalisation properties. i18n = { - defaultLocale = "ja_JP.UTF-8"; - extraLocaleSettings = { - LC_ADDRESS = "ja_JP.UTF-8"; - LC_IDENTIFICATION = "ja_JP.UTF-8"; - LC_MEASUREMENT = "ja_JP.UTF-8"; - LC_MONETARY = "ja_JP.UTF-8"; - LC_NAME = "ja_JP.UTF-8"; - LC_NUMERIC = "ja_JP.UTF-8"; - LC_PAPER = "ja_JP.UTF-8"; - LC_TELEPHONE = "ja_JP.UTF-8"; - LC_TIME = "ja_JP.UTF-8"; + # https://wiki.archlinux.jp/index.php/%E3%83%AD%E3%82%B1%E3%83%BC%E3%83%AB + LC_TIME = "en_DK.UTF-8"; # To prefer ISO 8601 format. See https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale }; }; }