From b5d4152d843c4a52176c62431c2bf7b3dfdc00cb Mon Sep 17 00:00:00 2001 From: Soispha Date: Sat, 22 Apr 2023 18:25:24 +0200 Subject: Feat(system/locale): Modularize keyMap setting --- system/locale/default.nix | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'system') diff --git a/system/locale/default.nix b/system/locale/default.nix index 6684f828..64aeae0e 100644 --- a/system/locale/default.nix +++ b/system/locale/default.nix @@ -1,24 +1,37 @@ # vim: ts=2 { config, - pkgs, + lib, ... -}: { - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n = { - defaultLocale = "en_CA.UTF-8"; - extraLocaleSettings = { - LANGUAGE = "en_CA:en_US:en"; - LC_TIME = "en_DK.UTF-8"; - LC_COLLATE = "C.UTF-8"; +}: let + cfg = config.soispha.locale; +in { + options.soispha.locale = { + enable = lib.mkEnableOption (lib.mdDoc "locale"); + keyMap = lib.mkOption { + type = lib.types.str; + example = "us"; + default = "dvorak"; }; }; - # Layout - console = { - keyMap = "us"; # TODO add a config switch for this + config = lib.mkIf cfg.enable { + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n = { + defaultLocale = "en_CA.UTF-8"; + extraLocaleSettings = { + LANGUAGE = "en_CA:en_US:en"; + LC_TIME = "en_DK.UTF-8"; + LC_COLLATE = "C.UTF-8"; + }; + }; + + # Layout + console = { + inherit (cfg) keyMap; + }; }; } -- cgit 1.4.1