From 1b5e860f65607b4cc7de4b6b5db95460cf144526 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Jan 2014 18:23:41 +0100 Subject: 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. --- nixos/modules/config/timezone.nix | 5 ++++- nixos/modules/system/etc/setup-etc.pl | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'nixos') diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix index 07a76d9ad1fa..979778046fda 100644 --- a/nixos/modules/config/timezone.nix +++ b/nixos/modules/config/timezone.nix @@ -27,7 +27,10 @@ with pkgs.lib; environment.variables.TZDIR = "/etc/zoneinfo"; environment.variables.TZ = config.time.timeZone; - environment.etc.localtime.source = "${pkgs.tzdata}/share/zoneinfo/${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"; diff --git a/nixos/modules/system/etc/setup-etc.pl b/nixos/modules/system/etc/setup-etc.pl index 7cb6d2a6a45e..4b79dbaab89e 100644 --- a/nixos/modules/system/etc/setup-etc.pl +++ b/nixos/modules/system/etc/setup-etc.pl @@ -57,9 +57,13 @@ sub link { open MODE, "<$_.mode"; my $mode = ; chomp $mode; close MODE; - copy "$static/$fn", "$target.tmp" or warn; - chmod oct($mode), "$target.tmp" or warn; - rename "$target.tmp", $target or warn; + if ($mode eq "direct-symlink") { + atomicSymlink readlink("$static/$fn"), $target or warn; + } else { + copy "$static/$fn", "$target.tmp" or warn; + chmod oct($mode), "$target.tmp" or warn; + rename "$target.tmp", $target or warn; + } } elsif (-l "$_") { atomicSymlink "$static/$fn", $target or warn; } -- cgit 1.4.1 From c32d0180e4fda3c69e9a50dfabb45dac004788f9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 6 Jan 2014 18:27:07 +0100 Subject: Don't set $TZ Now that Java is happy with our /etc/localtime, there is no reason to set $TZ anymore. (See 945849b86fe33474da569b307d7e5880877491b6, 279248f6c562eb88227d22b824c9324683980b96, 1b5e860f65607b4cc7de4b6b5db95460cf144526.) Fixes #1463. --- nixos/modules/config/timezone.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'nixos') diff --git a/nixos/modules/config/timezone.nix b/nixos/modules/config/timezone.nix index 979778046fda..42fbe841d070 100644 --- a/nixos/modules/config/timezone.nix +++ b/nixos/modules/config/timezone.nix @@ -25,7 +25,6 @@ with pkgs.lib; config = { environment.variables.TZDIR = "/etc/zoneinfo"; - environment.variables.TZ = config.time.timeZone; environment.etc.localtime = { source = "${pkgs.tzdata}/share/zoneinfo/${config.time.timeZone}"; -- cgit 1.4.1