From 479274775f25be4000e41ee6584ea0865e77808b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fi=C5=A1er?= Date: Wed, 27 May 2020 14:33:55 +0200 Subject: [PATCH] home-environment: add full locale options support Allows setting every locale option independently. Also fixes `LC_` order to match the order of `locale` command output for better reference. PR #1278 --- modules/home-environment.nix | 83 +++++++++++++++++++++++++++++++++--- 1 file changed, 77 insertions(+), 6 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 2f2b77d2..d868ee42 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -16,11 +16,35 @@ let ''; }; - address = mkOption { + ctype = mkOption { default = null; type = types.nullOr types.str; description = '' - The language to use for addresses. + Character classification category. + ''; + }; + + numeric = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for numerical values. + ''; + }; + + time = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for formatting times. + ''; + }; + + collate = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for collation (alphabetical ordering). ''; }; @@ -32,6 +56,14 @@ let ''; }; + messages = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for messages, application UI languages, etc. + ''; + }; + paper = mkOption { default = null; type = types.nullOr types.str; @@ -40,13 +72,38 @@ let ''; }; - time = mkOption { + name = mkOption { default = null; type = types.nullOr types.str; description = '' - The language to use for formatting times. + The language to use for personal names. ''; }; + + address = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for addresses. + ''; + }; + + telephone = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for telephone numbers. + ''; + }; + + measurement = mkOption { + default = null; + type = types.nullOr types.str; + description = '' + The language to use for measurement values. + ''; + }; + }; }; @@ -354,13 +411,27 @@ in in (maybeSet "LANG" cfg.language.base) // - (maybeSet "LC_ADDRESS" cfg.language.address) + (maybeSet "LC_CTYPE" cfg.language.ctype) + // + (maybeSet "LC_NUMERIC" cfg.language.numeric) + // + (maybeSet "LC_TIME" cfg.language.time) + // + (maybeSet "LC_COLLATE" cfg.language.collate) // (maybeSet "LC_MONETARY" cfg.language.monetary) // + (maybeSet "LC_MESSAGES" cfg.language.messages) + // (maybeSet "LC_PAPER" cfg.language.paper) // - (maybeSet "LC_TIME" cfg.language.time); + (maybeSet "LC_NAME" cfg.language.name) + // + (maybeSet "LC_ADDRESS" cfg.language.address) + // + (maybeSet "LC_TELEPHONE" cfg.language.telephone) + // + (maybeSet "LC_MEASUREMENT" cfg.language.measurement); home.packages = [ # Provide a file holding all session variables.