about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-04-22 18:25:24 +0200
committerSoispha <soispha@vhack.eu>2023-05-09 19:31:33 +0200
commitb5d4152d843c4a52176c62431c2bf7b3dfdc00cb (patch)
tree11e121861b212a0bd87fe2d255a23c19b137c05c
parentFix(hosts/apzu): Add correct hardware modules (diff)
downloadnixos-config-b5d4152d843c4a52176c62431c2bf7b3dfdc00cb.tar.gz
nixos-config-b5d4152d843c4a52176c62431c2bf7b3dfdc00cb.zip
Feat(system/locale): Modularize keyMap setting
-rw-r--r--hosts/apzu/default.nix9
-rw-r--r--hosts/lahmu/default.nix2
-rw-r--r--hosts/mammun/default.nix2
-rw-r--r--hosts/tiamat/default.nix14
-rw-r--r--system/locale/default.nix43
5 files changed, 40 insertions, 30 deletions
diff --git a/hosts/apzu/default.nix b/hosts/apzu/default.nix
index 2a21ffb9..3b787413 100644
--- a/hosts/apzu/default.nix
+++ b/hosts/apzu/default.nix
@@ -1,11 +1,5 @@
 # vim: ts=2
-{
-  config,
-  lib,
-  nixpkgs,
-  home-manager,
-  ...
-}: {
+{...}: {
   imports = [
     ./hardware
     ./networking.nix
@@ -14,6 +8,7 @@
   ];
 
   soispha = {
+    locale.enable = true;
     fs.backup = {
       enable = true;
       backupDiskUuid = "d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0";
diff --git a/hosts/lahmu/default.nix b/hosts/lahmu/default.nix
index a3274958..7a7aa9a4 100644
--- a/hosts/lahmu/default.nix
+++ b/hosts/lahmu/default.nix
@@ -14,6 +14,8 @@
   ];
 
   soispha = {
+
+    locale.enable = true;
     users = {
       # enable = true;
       hashedPassword = "$y$jFT$qi3wS9njrMl2y55b3NOBI0$j40Qt6AAkMSfZ82KPhqMaUaPztWtPps1wOqaXaF/L.6";
diff --git a/hosts/mammun/default.nix b/hosts/mammun/default.nix
index 0252e8e8..4bf0c975 100644
--- a/hosts/mammun/default.nix
+++ b/hosts/mammun/default.nix
@@ -14,6 +14,8 @@
     ../../system
   ];
   soispha = {
+
+    locale.enable = true;
     users = {
       hashedPassword = "$y$jDT$O/42/7REOL50onRYcTV9R1$Ot3bPAh2raHmPN3yScP4wsJRtNqrMtTBzOq9oRJeRA0";
     };
diff --git a/hosts/tiamat/default.nix b/hosts/tiamat/default.nix
index 2a21ffb9..7d568053 100644
--- a/hosts/tiamat/default.nix
+++ b/hosts/tiamat/default.nix
@@ -1,11 +1,5 @@
 # vim: ts=2
-{
-  config,
-  lib,
-  nixpkgs,
-  home-manager,
-  ...
-}: {
+{...}: {
   imports = [
     ./hardware
     ./networking.nix
@@ -14,12 +8,16 @@
   ];
 
   soispha = {
+    locale = {
+      enable = true;
+      keyMap = "us";
+    };
     fs.backup = {
       enable = true;
       backupDiskUuid = "d1c6e0f6-1837-40fd-bb29-251d5ea0ddb0";
     };
     users = {
-      hashedPassword = "$y$jFT$qi3wS9njrMl2y55b3NOBI0$j40Qt6AAkMSfZ82KPhqMaUaPztWtPps1wOqaXaF/L.6"; # TODO change this to a unique one
+      hashedPassword = "$y$jFT$qi3wS9njrMl2y55b3NOBI0$j40Qt6AAkMSfZ82KPhqMaUaPztWtPps1wOqaXaF/L.6";
     };
   };
 
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;
+    };
   };
 }