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.settings.systemd-timesyncd-test = {
19 "/var/lib/systemd/timesync".R = { };
20 "/var/lib/systemd/timesync".L.argument = "/var/lib/private/systemd/timesync";
21 "/var/lib/private/systemd/timesync".d = {
22 user = "systemd-timesync";
23 group = "systemd-timesync";
31 current.succeed("systemctl status systemd-timesyncd.service")
32 # on a new install with a recent systemd there should not be any
33 # leftovers from the dynamic user mess
34 current.succeed("test -e /var/lib/systemd/timesync")
35 current.succeed("test ! -L /var/lib/systemd/timesync")
37 # timesyncd should be running on the upgrading system since we fixed the
38 # file bits in the activation script
39 pre1909.succeed("systemctl status systemd-timesyncd.service")
41 # the path should be gone after the migration
42 pre1909.succeed("test ! -e /var/lib/private/systemd/timesync")
44 # and the new path should no longer be a symlink
45 pre1909.succeed("test -e /var/lib/systemd/timesync")
46 pre1909.succeed("test ! -L /var/lib/systemd/timesync")
48 # after a restart things should still work and not fail in the activation
49 # scripts and cause the boot to fail..
52 pre1909.succeed("systemctl status systemd-timesyncd.service")