diff options
-rw-r--r-- | nixos/modules/config/timezone.nix | 5 | ||||
-rw-r--r-- | nixos/modules/system/etc/setup-etc.pl | 10 |
2 files changed, 11 insertions, 4 deletions
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 = <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; } |