summary refs log tree commit diff
path: root/nixos/modules/config/timezone.nix
blob: e185584846a7bb15e5620ca3bb348ee1d47ca418 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ config, pkgs, ... }:

with pkgs.lib;

{
  options = {

    time = {

      timeZone = mkOption {
        default = "CET";
        type = with types; uniq string;
        example = "America/New_York";
        description = "The time zone used when displaying times and dates.";
      };

      hardwareClockInLocalTime = mkOption {
        default = false;
        description = "If set, keep the hardware clock in local time instead of UTC.";
      };

    };
  };

  config = {

    environment.variables.TZDIR = "/etc/zoneinfo";
    environment.variables.TZ = config.time.timeZone;

    environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}";

    environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";

  };

}