1 # Regression test for systemd-timesync having moved the state directory without
2 # upstream providing a migration path. https://github.com/systemd/systemd/issues/12131
4 import ./make-test-python.nix (let
5 common = { lib, ... }: {
6 # override the `false` value from the qemu-vm base profile
7 services.timesyncd.enable = lib.mkForce true;
9 mkVM = conf: { imports = [ conf common ]; };
11 name = "systemd-timesyncd";
14 pre1909 = mkVM ({lib, ... }: {
15 # create the path that should be migrated by our activation script when
16 # upgrading to a newer nixos version
17 system.stateVersion = "19.03";
18 systemd.tmpfiles.rules = [
19 "r /var/lib/systemd/timesync -"
20 "d /var/lib/systemd -"
21 "d /var/lib/private/systemd/timesync -"
22 "L /var/lib/systemd/timesync - - - - /var/lib/private/systemd/timesync"
23 "d /var/lib/private/systemd/timesync - systemd-timesync systemd-timesync -"
30 current.succeed("systemctl status systemd-timesyncd.service")
31 # on a new install with a recent systemd there should not be any
32 # leftovers from the dynamic user mess
33 current.succeed("test -e /var/lib/systemd/timesync")
34 current.succeed("test ! -L /var/lib/systemd/timesync")
36 # timesyncd should be running on the upgrading system since we fixed the
37 # file bits in the activation script
38 pre1909.succeed("systemctl status systemd-timesyncd.service")
40 # the path should be gone after the migration
41 pre1909.succeed("test ! -e /var/lib/private/systemd/timesync")
43 # and the new path should no longer be a symlink
44 pre1909.succeed("test -e /var/lib/systemd/timesync")
45 pre1909.succeed("test ! -L /var/lib/systemd/timesync")
47 # after a restart things should still work and not fail in the activation
48 # scripts and cause the boot to fail..
51 pre1909.succeed("systemctl status systemd-timesyncd.service")