summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-11-29 16:22:34 +0100
committerGitHub <noreply@github.com>2018-11-29 16:22:34 +0100
commit45c67945737f9e7158dd06d22c241efaf244c353 (patch)
tree325a34b5e1e30043b371d9f263444fcbd9833673 /nixos
parent6854b50c06709042b5e4eab1e3552e83e5ced301 (diff)
parent833ef67312b011663758eb46a3b0b19bef5b87b9 (diff)
downloadnixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar.gz
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar.bz2
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar.lz
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar.xz
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.tar.zst
nixpkgs-45c67945737f9e7158dd06d22c241efaf244c353.zip
Merge pull request #36424 from jfrankenau/i18n-extra-locale
nixos/i18n: add option for extra locale settings
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/config/i18n.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 6bf8c653e11..dc7305b1ba2 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -34,6 +34,17 @@ with lib;
         '';
       };
 
+      extraLocaleSettings = mkOption {
+        type = types.attrsOf types.str;
+        default = {};
+        example = { LC_MESSAGES = "en_US.UTF-8"; LC_TIME = "de_DE.UTF-8"; };
+        description = ''
+          A set of additional system-wide locale settings other than
+          <literal>LANG</literal> which can be configured with
+          <option>i18n.defaultLocale</option>.
+        '';
+      };
+
       supportedLocales = mkOption {
         type = types.listOf types.str;
         default = ["all"];
@@ -129,7 +140,7 @@ with lib;
     environment.sessionVariables =
       { LANG = config.i18n.defaultLocale;
         LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
-      };
+      } // config.i18n.extraLocaleSettings;
 
     systemd.globalEnvironment = mkIf (config.i18n.supportedLocales != []) {
       LOCALE_ARCHIVE = "${config.i18n.glibcLocales}/lib/locale/locale-archive";
@@ -141,6 +152,7 @@ with lib;
         source = pkgs.writeText "locale.conf"
           ''
             LANG=${config.i18n.defaultLocale}
+            ${concatStringsSep "\n" (mapAttrsToList (n: v: ''${n}=${v}'') config.i18n.extraLocaleSettings)}
           '';
       };