summaryrefslogtreecommitdiff
path: root/modules/sys/core/localization.nix
blob: 232133d8f5964344e7b4aa3e5852620f50ca73ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ config, lib, ... }:
{
  options.szpont.locale = {
    enable = lib.mkEnableOption "system localization (timezone and language)";

    timeZone = lib.mkOption {
      type = lib.types.str;
      default = "Europe/Warsaw";
      description = "the system timezone.";
    };

    format = lib.mkOption {
      type = lib.types.str;
      default = "pl_PL.UTF-8";
      description = "the locale used for numbers, time, and measurements.";
    };
  };

  config = lib.mkIf config.szpont.locale.enable {
    time.timeZone = config.szpont.locale.timeZone;

    i18n = {
      defaultLocale = "en_US.UTF-8";

      extraLocaleSettings = {
        LC_TIME = config.szpont.locale.format;
        LC_NUMERIC = config.szpont.locale.format;
        LC_MONETARY = config.szpont.locale.format;
        LC_PAPER = config.szpont.locale.format;
        LC_MEASUREMENT = config.szpont.locale.format;
        LC_COLLATE = config.szpont.locale.format;
        LC_NAME = config.szpont.locale.format;
        LC_ADDRESS = config.szpont.locale.format;
        LC_TELEPHONE = config.szpont.locale.format;
        LC_IDENTIFICATION = config.szpont.locale.format;
      };
    };
  };
}