nixpkgs/nixos/modules/config/timezone.nix
Eelco Dolstra 1b5e860f65 Make /etc/localtime a direct symlink to the zoneinfo file
Some programs (notably the Java Runtime Environment) expect to be able
to extract the name of the time zone from the target of the
/etc/localtime symlink.  That doesn't work if /etc/localtime is a
symlink to /etc/static/localtime.  So make it a direct symlink.
2014-01-06 18:23:41 +01:00

40 lines
802 B
Nix

{ config, pkgs, ... }:
with pkgs.lib;
{
options = {
time = {
timeZone = mkOption {
default = "CET";
type = types.str;
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}";
mode = "direct-symlink";
};
environment.etc.zoneinfo.source = "${pkgs.tzdata}/share/zoneinfo";
};
}