machines-config/nixosModules/locale/default.nix

53 lines
1.2 KiB
Nix
Raw Permalink Normal View History

2024-12-18 23:14:56 +01:00
{ config, lib, ... }:
let
cfg = config.kropcloud.locale;
in
{
options.kropcloud.locale = {
timeZone = lib.mkOption {
type = lib.types.str;
default = "Europe/Prague";
description = "The timezone for the system.";
};
keyMap = lib.mkOption {
type = lib.types.str;
default = "cz-lat2";
description = "The keymap to use for console input.";
};
defaultLocale = lib.mkOption {
type = lib.types.str;
default = "en_GB.UTF-8";
description = "The default locale for the system.";
};
extraLocale = lib.mkOption {
type = lib.types.str;
default = "cs_CZ.UTF-8";
description = "The locale to apply uniformly to all LC_* categories.";
};
};
config = {
# Set the system timezone.
time.timeZone = cfg.timeZone;
# Set the default locale.
i18n.defaultLocale = cfg.defaultLocale;
# Apply the same locale to all LC_* categories.
i18n.extraLocaleSettings = lib.genAttrs [
"LC_ADDRESS"
"LC_IDENTIFICATION"
"LC_MEASUREMENT"
"LC_MONETARY"
"LC_NAME"
"LC_NUMERIC"
"LC_PAPER"
"LC_TELEPHONE"
"LC_TIME"
] (_: cfg.extraLocale);
# Set the console keymap.
console.keyMap = cfg.keyMap;
};
}