From e60f8f4ce3daeb891ce8a735563676088d87cbd2 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 8 Jul 2024 02:50:50 +0200 Subject: [PATCH] Allow configuring languages --- lib/modules/i18n.nix | 27 +++++++++++++++++++++++++++ profiles/Generic/config.nix | 11 +++++++++++ 2 files changed, 38 insertions(+) create mode 100644 lib/modules/i18n.nix diff --git a/lib/modules/i18n.nix b/lib/modules/i18n.nix new file mode 100644 index 00000000..fb1905c3 --- /dev/null +++ b/lib/modules/i18n.nix @@ -0,0 +1,27 @@ +{ lib, config, ... }: + let + inherit (lib) + types + ; + + cfg = config.i18n; + in { + options = { + i18n = { + localeSettings = { + type = types.attrsOf types.str; + description = "The system wide locale settings"; + default = {}; + }; + + locales = { + type = types.listOf types.str; + description = "The locales of the system"; + }; + }; + }; + + config = { + locales = builtins.attrValues cfg.localeSettings; + }; + } diff --git a/profiles/Generic/config.nix b/profiles/Generic/config.nix index 7f9a4d2d..759a7d87 100644 --- a/profiles/Generic/config.nix +++ b/profiles/Generic/config.nix @@ -4,6 +4,7 @@ in { imports = [ ../../lib/modules/partition.nix + ../../lib/modules/i18n.nix ]; config = { @@ -32,5 +33,15 @@ }; }; }; + + i18n = { + localeSettings = + let defaultLocale = "en_US.UTF-8"; + in { + LANG = "de_CH.UTF-8"; + LANGUAGE = defaultLocale; + LC_MESSAGE = defaultLocale; + }; + }; }; }