Manually set date and time on NixOS

Since timedatectl can’t be used, in order to change NixOS system time manually, there are two ways I found.

  1. Use hwclock --date "1970-01-01" --set then sync with system clock hwclock -s.
  2. Use date -s "1970-01-01"

But, both of the command must be executed after disable systemd-timesyncd.service.

sudo systemctl stop systemd-timesyncd.service

I found it nowhere in the Internet that works, so I made this notes anyone looking for it in the future (myself?).

3 Likes