nixos: allow supply customized locale package
Overriding ``glibcLocales`` via nixpkgs.overlays not works, so I added i18n.glibcLocales parameter, defaulted with old override, using i18n.supportedLocales.
This commit is contained in:
parent
8c40604459
commit
2c54fa04be
@ -2,21 +2,27 @@
|
|||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
glibcLocales = pkgs.glibcLocales.override {
|
|
||||||
allLocales = any (x: x == "all") config.i18n.supportedLocales;
|
|
||||||
locales = config.i18n.supportedLocales;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
{
|
{
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
i18n = {
|
i18n = {
|
||||||
|
glibcLocales = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = pkgs.glibcLocales.override {
|
||||||
|
allLocales = any (x: x == "all") config.i18n.supportedLocales;
|
||||||
|
locales = config.i18n.supportedLocales;
|
||||||
|
};
|
||||||
|
example = literalExample "pkgs.glibcLocales";
|
||||||
|
description = ''
|
||||||
|
Customized pkg.glibcLocales package.
|
||||||
|
|
||||||
|
Changing this option can disable handling of i18n.defaultLocale
|
||||||
|
and supportedLocale.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
defaultLocale = mkOption {
|
defaultLocale = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "en_US.UTF-8";
|
default = "en_US.UTF-8";
|
||||||
@ -118,7 +124,7 @@ in
|
|||||||
'');
|
'');
|
||||||
|
|
||||||
environment.systemPackages =
|
environment.systemPackages =
|
||||||
optional (config.i18n.supportedLocales != []) glibcLocales;
|
optional (config.i18n.supportedLocales != []) config.i18n.glibcLocales;
|
||||||
|
|
||||||
environment.sessionVariables =
|
environment.sessionVariables =
|
||||||
{ LANG = config.i18n.defaultLocale;
|
{ LANG = config.i18n.defaultLocale;
|
||||||
@ -126,7 +132,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
systemd.globalEnvironment = mkIf (config.i18n.supportedLocales != []) {
|
systemd.globalEnvironment = mkIf (config.i18n.supportedLocales != []) {
|
||||||
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${config.i18n.glibcLocales}/lib/locale/locale-archive";
|
||||||
};
|
};
|
||||||
|
|
||||||
# ‘/etc/locale.conf’ is used by systemd.
|
# ‘/etc/locale.conf’ is used by systemd.
|
||||||
|
Loading…
Reference in New Issue
Block a user