1
1
Fork 0

Factor out time zone and NTP

This commit is contained in:
Tim Van Baak 2023-08-02 02:17:10 +00:00
parent 4e8a2bb7e4
commit 7feec36673
2 changed files with 24 additions and 16 deletions

View File

@ -17,14 +17,6 @@
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "UTC";
services.ntp = {
enable = true;
servers = [ "time.nist.gov" ];
};
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";

View File

@ -1,18 +1,34 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption types;
inherit (lib) mkIf mkMerge mkOption types;
cfg = config.beatific;
in {
options = {
beatific.hostName = mkOption {
beatific = {
hostName = mkOption {
type = types.str;
description = "Hostname";
};
defaults = {
time = mkOption {
type = types.bool;
description = "Default time zone and NTP";
default = true;
};
};
};
};
config = let
in {
config = mkMerge [
{
networking.hostName = cfg.hostName;
};
}
(mkIf cfg.defaults.time {
time.timeZone = "UTC";
services.ntp.enable = true;
services.ntp.servers = [ "time.nist.gov" ];
})
];
}