Allow configuring languages

This commit is contained in:
Manuel Thalmann 2024-07-08 02:50:50 +02:00
parent a5d25522fd
commit e60f8f4ce3
2 changed files with 38 additions and 0 deletions

27
lib/modules/i18n.nix Normal file
View file

@ -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;
};
}

View file

@ -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;
};
};
};
}