Factor out time zone and NTP
This commit is contained in:
parent
4e8a2bb7e4
commit
7feec36673
@ -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";
|
||||
|
||||
|
@ -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 {
|
||||
type = types.str;
|
||||
description = "Hostname";
|
||||
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 {
|
||||
networking.hostName = cfg.hostName;
|
||||
};
|
||||
config = mkMerge [
|
||||
{
|
||||
networking.hostName = cfg.hostName;
|
||||
}
|
||||
(mkIf cfg.defaults.time {
|
||||
time.timeZone = "UTC";
|
||||
services.ntp.enable = true;
|
||||
services.ntp.servers = [ "time.nist.gov" ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user