Merge master into staging-next

This commit is contained in:
nixpkgs-ci[bot] 2025-04-30 09:29:33 +00:00 committed by GitHub
commit 57718699b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
52 changed files with 751 additions and 1396 deletions

View file

@ -4,6 +4,16 @@
pkgs,
...
}:
let
aggregatedLocales =
builtins.map
(l: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8")
(
[ config.i18n.defaultLocale ]
++ config.i18n.extraLocales
++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings))
);
in
{
###### interface
@ -42,6 +52,17 @@
'';
};
extraLocales = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "nl_NL.UTF-8" ];
description = ''
Additional locales that the system should support, besides the ones
configured with {option}`i18n.defaultLocale` and
{option}`i18n.extraLocaleSettings`.
'';
};
extraLocaleSettings = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
@ -58,28 +79,14 @@
supportedLocales = lib.mkOption {
type = lib.types.listOf lib.types.str;
visible = false;
default = lib.unique (
builtins.map
(l: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8")
(
[
"C.UTF-8"
"en_US.UTF-8"
config.i18n.defaultLocale
]
++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings))
)
[
"C.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
]
++ aggregatedLocales
);
defaultText = lib.literalExpression ''
lib.unique
(builtins.map (l: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8") (
[
"C.UTF-8"
"en_US.UTF-8"
config.i18n.defaultLocale
] ++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings))
))
'';
example = [
"en_US.UTF-8/UTF-8"
"nl_NL.UTF-8/UTF-8"
@ -100,6 +107,18 @@
###### implementation
config = {
warnings =
lib.optional ((lib.subtractLists config.i18n.supportedLocales aggregatedLocales) != [ ])
''
`i18n.supportedLocales` is deprecated in favor of `i18n.extraLocales`,
and it seems you are using `i18n.supportedLocales` and forgot to
include some locales specified in `i18n.defaultLocale`,
`i18n.extraLocales` or `i18n.extraLocaleSettings`.
If you're trying to install additional locales not specified in
`i18n.defaultLocale` or `i18n.extraLocaleSettings`, consider adding
only those locales to `i18n.extraLocales`.
'';
environment.systemPackages =
# We increase the priority a little, so that plain glibc in systemPackages can't win.