Factor out time zone and NTP
This commit is contained in:
parent
4e8a2bb7e4
commit
7feec36673
|
@ -17,14 +17,6 @@
|
||||||
# Enable networking
|
# Enable networking
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "UTC";
|
|
||||||
|
|
||||||
services.ntp = {
|
|
||||||
enable = true;
|
|
||||||
servers = [ "time.nist.gov" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Select internationalisation properties.
|
# Select internationalisation properties.
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,34 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) mkIf mkMerge mkOption types;
|
||||||
cfg = config.beatific;
|
cfg = config.beatific;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
beatific.hostName = mkOption {
|
beatific = {
|
||||||
type = types.str;
|
hostName = mkOption {
|
||||||
description = "Hostname";
|
type = types.str;
|
||||||
|
description = "Hostname";
|
||||||
|
};
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
time = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "Default time zone and NTP";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = mkMerge [
|
||||||
in {
|
{
|
||||||
networking.hostName = cfg.hostName;
|
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