Factor out i18n settings
This commit is contained in:
parent
656fdeef49
commit
2a618ce67f
|
@ -17,21 +17,6 @@
|
||||||
# Enable networking
|
# Enable networking
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
# Select internationalisation properties.
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
|
|
||||||
i18n.extraLocaleSettings = {
|
|
||||||
LC_ADDRESS = "en_US.UTF-8";
|
|
||||||
LC_IDENTIFICATION = "en_US.UTF-8";
|
|
||||||
LC_MEASUREMENT = "en_US.UTF-8";
|
|
||||||
LC_MONETARY = "en_US.UTF-8";
|
|
||||||
LC_NAME = "en_US.UTF-8";
|
|
||||||
LC_NUMERIC = "en_US.UTF-8";
|
|
||||||
LC_PAPER = "en_US.UTF-8";
|
|
||||||
LC_TELEPHONE = "en_US.UTF-8";
|
|
||||||
LC_TIME = "en_US.UTF-8";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.tvb = {
|
users.users.tvb = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
|
|
@ -1,36 +1,67 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkIf mkMerge mkOption types;
|
inherit (lib) mkDefault mkIf mkMerge mkOption types;
|
||||||
cfg = config.beatific;
|
cfg = config.beatific;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
beatific = {
|
beatific = {
|
||||||
|
# The host name is reused for beatific-specific configuration.
|
||||||
|
# The bulk of common config is handled in beatific.defaults below, but
|
||||||
|
# having one option without a default ensures that the module cannot be
|
||||||
|
# imported accidentally.
|
||||||
hostName = mkOption {
|
hostName = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "Hostname";
|
description = "Hostname";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Groups of related defaults can be disabled by flipping off the switches here:
|
||||||
|
# beatific.defaults.${category} = false;
|
||||||
|
# They default to true because the point is to do these things by default.
|
||||||
defaults = {
|
defaults = {
|
||||||
time = mkOption {
|
time = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "Default time zone and NTP";
|
description = "Default time zone and NTP";
|
||||||
default = true;
|
default = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
i18n = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "Default locale settings";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
{
|
{
|
||||||
|
# Options to always set
|
||||||
networking.hostName = cfg.hostName;
|
networking.hostName = cfg.hostName;
|
||||||
|
|
||||||
nix.extraOptions = "experimental-features = nix-command flakes";
|
nix.extraOptions = "experimental-features = nix-command flakes";
|
||||||
}
|
}
|
||||||
|
|
||||||
(mkIf cfg.defaults.time {
|
(mkIf cfg.defaults.time {
|
||||||
time.timeZone = "UTC";
|
# mkDefault time zone to make it easy to configure it to non-UTC
|
||||||
|
time.timeZone = mkDefault "UTC";
|
||||||
services.ntp.enable = true;
|
services.ntp.enable = true;
|
||||||
services.ntp.servers = [ "time.nist.gov" ];
|
services.ntp.servers = [ "time.nist.gov" ];
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.defaults.i18n {
|
||||||
|
# en_US.UTF-8
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
i18n.extraLocaleSettings = {
|
||||||
|
LC_ADDRESS = "en_US.UTF-8";
|
||||||
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||||
|
LC_MEASUREMENT = "en_US.UTF-8";
|
||||||
|
LC_MONETARY = "en_US.UTF-8";
|
||||||
|
LC_NAME = "en_US.UTF-8";
|
||||||
|
LC_NUMERIC = "en_US.UTF-8";
|
||||||
|
LC_PAPER = "en_US.UTF-8";
|
||||||
|
LC_TELEPHONE = "en_US.UTF-8";
|
||||||
|
LC_TIME = "en_US.UTF-8";
|
||||||
|
};
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue