summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2021-12-22 11:52:27 +0100
committerGitHub <noreply@github.com>2021-12-22 11:52:27 +0100
commit60e571fa406a58a6c73e428b0f3e6bd24acef665 (patch)
treefa212123b76cae71c9c86f35b898c4bba7017d1c /nixos
parent5604ce4fb7d82b51cca77ad5c6a58cd249a91fd6 (diff)
parent901d4f13a3e30b4f4634c721b5cde6fabcd5405c (diff)
downloadnixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar.gz
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar.bz2
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar.lz
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar.xz
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.tar.zst
nixpkgs-60e571fa406a58a6c73e428b0f3e6bd24acef665.zip
Merge pull request #150922 from ncfavier/systemd-tzdir
nixos/systemd: set TZDIR for PID 1
Diffstat (limited to 'nixos')
-rwxr-xr-x[-rw-r--r--]nixos/modules/system/boot/stage-2-init.sh1
-rw-r--r--nixos/tests/systemd.nix12
2 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index afaca2e4158..a90f58042d2 100644..100755
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -172,4 +172,5 @@ echo "starting systemd..."
 
 PATH=/run/current-system/systemd/lib/systemd:@fsPackagesPath@ \
     LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive @systemdUnitPathEnvVar@ \
+    TZDIR=/etc/zoneinfo \
     exec @systemdExecutable@
diff --git a/nixos/tests/systemd.nix b/nixos/tests/systemd.nix
index 6561f7efe1a..f86daa5eea9 100644
--- a/nixos/tests/systemd.nix
+++ b/nixos/tests/systemd.nix
@@ -31,6 +31,13 @@ import ./make-test-python.nix ({ pkgs, ... }: {
       umount /tmp/shared
     '';
 
+    systemd.services.oncalendar-test = {
+      description = "calendar test";
+      # Japan does not have DST which makes the test a little bit simpler
+      startAt = "Wed 10:00 Asia/Tokyo";
+      script = "true";
+    };
+
     systemd.services.testservice1 = {
       description = "Test Service 1";
       wantedBy = [ "multi-user.target" ];
@@ -69,6 +76,11 @@ import ./make-test-python.nix ({ pkgs, ... }: {
     # wait for user services
     machine.wait_for_unit("default.target", "alice")
 
+    # Regression test for https://github.com/NixOS/nixpkgs/issues/105049
+    with subtest("systemd reads timezone database in /etc/zoneinfo"):
+        timer = machine.succeed("TZ=UTC systemctl show --property=TimersCalendar oncalendar-test.timer")
+        assert re.search("next_elapse=Wed ....-..-.. 01:00:00 UTC", timer), f"got {timer.strip()}"
+
     # Regression test for https://github.com/NixOS/nixpkgs/issues/35415
     with subtest("configuration files are recognized by systemd"):
         machine.succeed("test -e /system_conf_read")