Files
NixOsConfig/modules/nixos/core/locale.nix
T
Claude 7dd6853124 Normalize file modes to 644
All tracked files were committed as 755; only Nix reads them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
2026-10-12 20:41:48 +00:00

58 lines
1.4 KiB
Nix

# Time zone, locale and keyboard layout (also used by the console and by the
# home-manager Hyprland module through osConfig).
{ config, lib, ... }:
let
cfg = config.my.locale;
inherit (lib) mkOption types;
in
{
options.my.locale = {
timeZone = mkOption {
type = types.str;
example = "Europe/Moscow";
description = "IANA time zone name.";
};
defaultLocale = mkOption {
type = types.str;
default = "en_US.UTF-8";
description = "Default system locale (LANG).";
};
keyboardLayouts = mkOption {
type = types.listOf types.str;
default = [ "us" ];
example = [
"us"
"ru"
];
description = "XKB layouts, in switching order.";
};
keyboardOptions = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "grp:alt_shift_toggle" ];
description = "XKB options such as the layout toggle shortcut.";
};
};
config = {
time.timeZone = cfg.timeZone;
i18n = {
inherit (cfg) defaultLocale;
# Russian stays available for apps and games even with an English UI.
extraLocales = [ "ru_RU.UTF-8/UTF-8" ];
};
services.xserver.xkb = {
layout = lib.concatStringsSep "," cfg.keyboardLayouts;
options = lib.concatStringsSep "," cfg.keyboardOptions;
};
# TTY and initrd keymap follow the XKB layout above.
console.useXkbConfig = true;
};
}