diff --git a/hosts/matej-nixos/configuration.nix b/hosts/matej-nixos/configuration.nix index f10378f..5fe2c82 100644 --- a/hosts/matej-nixos/configuration.nix +++ b/hosts/matej-nixos/configuration.nix @@ -25,6 +25,7 @@ in inputs.self.nixosModules.workstation inputs.self.nixosModules.nvidia inputs.self.nixosModules.initrd-ssh + inputs.self.nixosModules.localisation ]; yubikey.enable = true; @@ -67,9 +68,11 @@ in boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - time.timeZone = "Europe/Ljubljana"; - environment.variables.TZ = "America/New_York"; - i18n.defaultLocale = "en_US.UTF-8"; + localisation = { + enable = true; + timeZone = "Europe/Ljubljana"; + defaultLocale = "en_US.UTF-8"; + }; # WARN:(@janezicmatej) nix-ld for running pip-installed binaries outside nix, probably want to drop this programs.nix-ld.enable = true; diff --git a/hosts/matej-tower/configuration.nix b/hosts/matej-tower/configuration.nix index edb467b..10c4b66 100644 --- a/hosts/matej-tower/configuration.nix +++ b/hosts/matej-tower/configuration.nix @@ -23,6 +23,7 @@ inputs.self.nixosModules.tuigreet inputs.self.nixosModules.workstation inputs.self.nixosModules.initrd-ssh + inputs.self.nixosModules.localisation ]; yubikey.enable = true; @@ -59,8 +60,11 @@ pkiBundle = "/var/lib/sbctl"; }; - time.timeZone = "Europe/Ljubljana"; - environment.variables.TZ = "Europe/Ljubljana"; + localisation = { + enable = true; + timeZone = "Europe/Ljubljana"; + defaultLocale = "en_US.UTF-8"; + }; services.udisks2.enable = true; diff --git a/modules/nixos/localisation.nix b/modules/nixos/localisation.nix new file mode 100644 index 0000000..85ceab0 --- /dev/null +++ b/modules/nixos/localisation.nix @@ -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; + }; +}