1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 tzdir = "${pkgs.tzdata}/share/zoneinfo";
8
9in
10
11{
12 options = {
13
14 time = {
15
16 timeZone = mkOption {
17 default = "UTC";
18 type = types.str;
19 example = "America/New_York";
20 description = ''
21 The time zone used when displaying times and dates. See <link
22 xlink:href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"/>
23 for a comprehensive list of possible values for this setting.
24 '';
25 };
26
27 hardwareClockInLocalTime = mkOption {
28 default = false;
29 type = types.bool;
30 description = "If set, keep the hardware clock in local time instead of UTC.";
31 };
32
33 };
34 };
35
36 config = {
37
38 environment.sessionVariables.TZDIR = "/etc/zoneinfo";
39
40 systemd.globalEnvironment.TZDIR = tzdir;
41
42 environment.etc.localtime =
43 { source = "${tzdir}/${config.time.timeZone}";
44 mode = "direct-symlink";
45 };
46
47 environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
48
49 };
50
51}