From 808ab9fea5169f6d587aff05fd3e17e6fb56c336 Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Tue, 9 Jan 2024 13:19:42 +0100 Subject: [PATCH] Small refactor to make locale a global setting --- nixos/desktop/configuration.nix | 18 +++--------------- nixos/hosts/queen/configuration.nix | 19 ++++--------------- nixos/hosts/shodan/configuration.nix | 18 +++--------------- nixos/hosts/wheatley/configuration.nix | 19 +++---------------- nixos/shared/locale/configuration.nix | 23 +++++++++++++++++++++++ 5 files changed, 36 insertions(+), 61 deletions(-) create mode 100644 nixos/shared/locale/configuration.nix diff --git a/nixos/desktop/configuration.nix b/nixos/desktop/configuration.nix index d375717..f50a040 100644 --- a/nixos/desktop/configuration.nix +++ b/nixos/desktop/configuration.nix @@ -8,6 +8,9 @@ pkgs, ... }: { + imports = [ + ../shared/locale/configuration.nix + ]; nixpkgs = { # You can add overlays here overlays = [ @@ -101,21 +104,6 @@ # Set your time zone. time.timeZone = "Europe/Amsterdam"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "nl_NL.UTF-8"; - LC_IDENTIFICATION = "nl_NL.UTF-8"; - LC_MEASUREMENT = "nl_NL.UTF-8"; - LC_MONETARY = "nl_NL.UTF-8"; - LC_NAME = "nl_NL.UTF-8"; - LC_NUMERIC = "nl_NL.UTF-8"; - LC_PAPER = "nl_NL.UTF-8"; - LC_TELEPHONE = "nl_NL.UTF-8"; - LC_TIME = "en_DK.UTF-8"; - }; - # Enable the X11 windowing system. services.xserver.enable = true; diff --git a/nixos/hosts/queen/configuration.nix b/nixos/hosts/queen/configuration.nix index 785e5c2..b8d0f59 100644 --- a/nixos/hosts/queen/configuration.nix +++ b/nixos/hosts/queen/configuration.nix @@ -16,6 +16,10 @@ # You can also split up your configuration and import pieces of it here: # ./nvim.nix ./hardware-configuration.nix + + # Import locale settings + ../../shared/locale/configuration.nix + #../../server/package-configs/akkoma/configuration.nix ../../server/package-configs/forgejo/configuration.nix ../../server/package-configs/gotosocial/configuration.nix @@ -134,21 +138,6 @@ # Set your time zone. time.timeZone = "Europe/Amsterdam"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "nl_NL.UTF-8"; - LC_IDENTIFICATION = "nl_NL.UTF-8"; - LC_MEASUREMENT = "nl_NL.UTF-8"; - LC_MONETARY = "nl_NL.UTF-8"; - LC_NAME = "nl_NL.UTF-8"; - LC_NUMERIC = "nl_NL.UTF-8"; - LC_PAPER = "nl_NL.UTF-8"; - LC_TELEPHONE = "nl_NL.UTF-8"; - LC_TIME = "en_DK.UTF-8"; - }; - programs.zsh = { enable = true; }; diff --git a/nixos/hosts/shodan/configuration.nix b/nixos/hosts/shodan/configuration.nix index 679958e..ab3fae2 100644 --- a/nixos/hosts/shodan/configuration.nix +++ b/nixos/hosts/shodan/configuration.nix @@ -26,6 +26,9 @@ # Or modules exported from other flakes (such as nix-colors): # inputs.nix-colors.homeManagerModules.default + # Import the locale settings + ../../shared/locale/configuration.nix + # You can also split up your configuration and import pieces of it here: # ./nvim.nix ./hardware-configuration.nix @@ -175,21 +178,6 @@ # Set your time zone. time.timeZone = "Europe/Amsterdam"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "nl_NL.UTF-8"; - LC_IDENTIFICATION = "nl_NL.UTF-8"; - LC_MEASUREMENT = "nl_NL.UTF-8"; - LC_MONETARY = "nl_NL.UTF-8"; - LC_NAME = "nl_NL.UTF-8"; - LC_NUMERIC = "nl_NL.UTF-8"; - LC_PAPER = "nl_NL.UTF-8"; - LC_TELEPHONE = "nl_NL.UTF-8"; - LC_TIME = "en_DK.UTF8"; - }; - # Enable CUPS to print documents. services.printing.enable = true; diff --git a/nixos/hosts/wheatley/configuration.nix b/nixos/hosts/wheatley/configuration.nix index a285a43..fbf15bc 100644 --- a/nixos/hosts/wheatley/configuration.nix +++ b/nixos/hosts/wheatley/configuration.nix @@ -11,7 +11,9 @@ # nixos-generate-config should normally set up file systems correctly imports = [ - #inputs.home-manager.nixosModules.home-manager + inputs.home-manager.nixosModules.home-manager + # Import locale settings + ../../shared/locale/configuration.nix ./hardware-configuration.nix ]; @@ -149,21 +151,6 @@ # Set your time zone. time.timeZone = "Europe/Amsterdam"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "nl_NL.UTF-8"; - LC_IDENTIFICATION = "nl_NL.UTF-8"; - LC_MEASUREMENT = "nl_NL.UTF-8"; - LC_MONETARY = "nl_NL.UTF-8"; - LC_NAME = "nl_NL.UTF-8"; - LC_NUMERIC = "nl_NL.UTF-8"; - LC_PAPER = "nl_NL.UTF-8"; - LC_TELEPHONE = "nl_NL.UTF-8"; - LC_TIME = "en_DK.UTF-8"; - }; - programs.zsh = { enable = true; }; diff --git a/nixos/shared/locale/configuration.nix b/nixos/shared/locale/configuration.nix new file mode 100644 index 0000000..2444204 --- /dev/null +++ b/nixos/shared/locale/configuration.nix @@ -0,0 +1,23 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "nl_NL.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "nl_NL.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "en_DK.UTF8"; + }; +}