feat: add localisation module

This commit is contained in:
2026-02-25 05:40:04 -05:00
parent db3ceb7eac
commit d229155898
3 changed files with 40 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ in
inputs.self.nixosModules.workstation inputs.self.nixosModules.workstation
inputs.self.nixosModules.nvidia inputs.self.nixosModules.nvidia
inputs.self.nixosModules.initrd-ssh inputs.self.nixosModules.initrd-ssh
inputs.self.nixosModules.localisation
]; ];
yubikey.enable = true; yubikey.enable = true;
@@ -67,9 +68,11 @@ in
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Europe/Ljubljana"; localisation = {
environment.variables.TZ = "America/New_York"; enable = true;
i18n.defaultLocale = "en_US.UTF-8"; timeZone = "Europe/Ljubljana";
defaultLocale = "en_US.UTF-8";
};
# WARN:(@janezicmatej) nix-ld for running pip-installed binaries outside nix, probably want to drop this # WARN:(@janezicmatej) nix-ld for running pip-installed binaries outside nix, probably want to drop this
programs.nix-ld.enable = true; programs.nix-ld.enable = true;

View File

@@ -23,6 +23,7 @@
inputs.self.nixosModules.tuigreet inputs.self.nixosModules.tuigreet
inputs.self.nixosModules.workstation inputs.self.nixosModules.workstation
inputs.self.nixosModules.initrd-ssh inputs.self.nixosModules.initrd-ssh
inputs.self.nixosModules.localisation
]; ];
yubikey.enable = true; yubikey.enable = true;
@@ -59,8 +60,11 @@
pkiBundle = "/var/lib/sbctl"; pkiBundle = "/var/lib/sbctl";
}; };
time.timeZone = "Europe/Ljubljana"; localisation = {
environment.variables.TZ = "Europe/Ljubljana"; enable = true;
timeZone = "Europe/Ljubljana";
defaultLocale = "en_US.UTF-8";
};
services.udisks2.enable = true; services.udisks2.enable = true;

View File

@@ -0,0 +1,28 @@
{
lib,
config,
...
}:
{
options = {
localisation = {
enable = lib.mkEnableOption "localisation defaults";
timeZone = lib.mkOption {
type = lib.types.str;
};
defaultLocale = lib.mkOption {
type = lib.types.str;
};
};
};
config = lib.mkIf config.localisation.enable {
time.timeZone = config.localisation.timeZone;
i18n.defaultLocale = config.localisation.defaultLocale;
# NOTE:(@janezicmatej) some apps (e.g. java) need TZ env var explicitly
environment.variables.TZ = config.localisation.timeZone;
};
}