2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-05-28 00:14:38 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-05-28 00:14:38 +01:00
|
|
|
|
2014-05-21 17:26:13 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
tzdir = "${pkgs.tzdata}/share/zoneinfo";
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2011-10-27 20:36:03 +01:00
|
|
|
{
|
2009-05-28 00:14:38 +01:00
|
|
|
options = {
|
|
|
|
|
2012-07-02 20:34:27 +01:00
|
|
|
time = {
|
2013-04-22 17:56:19 +01:00
|
|
|
|
2012-07-02 20:34:27 +01:00
|
|
|
timeZone = mkOption {
|
2017-07-31 15:55:24 +01:00
|
|
|
default = null;
|
|
|
|
type = types.nullOr types.str;
|
2012-07-02 20:34:27 +01:00
|
|
|
example = "America/New_York";
|
2014-12-15 15:28:40 +00:00
|
|
|
description = ''
|
|
|
|
The time zone used when displaying times and dates. See <link
|
|
|
|
xlink:href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"/>
|
|
|
|
for a comprehensive list of possible values for this setting.
|
2017-07-31 15:55:24 +01:00
|
|
|
|
|
|
|
If null, the timezone will default to UTC and can be set imperatively
|
|
|
|
using timedatectl.
|
2014-12-15 15:28:40 +00:00
|
|
|
'';
|
2012-07-02 20:34:27 +01:00
|
|
|
};
|
2009-05-28 00:14:38 +01:00
|
|
|
|
2012-07-11 20:33:34 +01:00
|
|
|
hardwareClockInLocalTime = mkOption {
|
2012-07-02 20:34:27 +01:00
|
|
|
default = false;
|
2015-07-19 17:49:23 +01:00
|
|
|
type = types.bool;
|
2012-07-11 20:33:34 +01:00
|
|
|
description = "If set, keep the hardware clock in local time instead of UTC.";
|
2012-07-02 20:34:27 +01:00
|
|
|
};
|
2013-04-22 17:56:19 +01:00
|
|
|
|
2012-07-02 20:34:27 +01:00
|
|
|
};
|
2009-05-28 00:14:38 +01:00
|
|
|
};
|
|
|
|
|
2011-10-27 20:36:03 +01:00
|
|
|
config = {
|
2009-05-28 00:14:38 +01:00
|
|
|
|
2014-06-13 16:56:46 +01:00
|
|
|
environment.sessionVariables.TZDIR = "/etc/zoneinfo";
|
2009-05-28 00:14:38 +01:00
|
|
|
|
2016-10-11 12:49:38 +01:00
|
|
|
# This way services are restarted when tzdata changes.
|
2014-05-21 17:26:13 +01:00
|
|
|
systemd.globalEnvironment.TZDIR = tzdir;
|
|
|
|
|
2017-07-31 15:55:24 +01:00
|
|
|
systemd.services.systemd-timedated.environment = lib.optionalAttrs (config.time.timeZone != null) { NIXOS_STATIC_TIMEZONE = "1"; };
|
2013-04-22 17:56:19 +01:00
|
|
|
|
2017-07-31 15:55:24 +01:00
|
|
|
environment.etc = {
|
|
|
|
zoneinfo.source = tzdir;
|
2017-07-31 16:12:53 +01:00
|
|
|
} // lib.optionalAttrs (config.time.timeZone != null) {
|
2017-07-31 15:55:24 +01:00
|
|
|
localtime.source = "/etc/zoneinfo/${config.time.timeZone}";
|
|
|
|
localtime.mode = "direct-symlink";
|
|
|
|
};
|
2011-10-27 20:36:03 +01:00
|
|
|
};
|
2013-04-22 17:56:19 +01:00
|
|
|
|
2009-05-28 00:14:38 +01:00
|
|
|
}
|