21
submitted 3 days ago by dadarobot@lemmy.ml to c/nix@programming.dev

ive got a surface tablet at work running nixos. it mostly is used to view security cameras.

the machine is fairly low spec and bogs itself down after a coupke days, so id like it to auto reboot at 9am. i work a late shift and often don't leave til around 2am.

i guess we don't use cron anymore? i really don't understand how the systemd timers work... the wiki doesnt really give great details...

systemd.timers."autoreboot" = {

wantedBy = [ "timers.target" ];

timerConfig = {

  OnCalendar="*-*-* 9:00:00";                                     Unit = "autoreboot.service";

};

};

systemd.services."autoreboot" = {

script = ''

set -eu

${pkgs.coreutils}/run/current-system/sw/bin/reboot

'';

serviceConfig = {

Type = "oneshot";

User = "root";

};

};

the systemd target seems to be created, but it reports as dead when i check it...

any advice?

you are viewing a single comment's thread
view the rest of the comments
[-] jet@hackertalks.com 3 points 2 days ago

"${pkgs.systemd}/bin/systemctl --no-block reboot";

maybe something like this, but for testing just touch a file and see if it actually is triggering for you

this post was submitted on 01 Aug 2026
21 points (100.0% liked)

Nix / NixOS

2819 readers
1 users here now

Main links

Videos

founded 3 years ago
MODERATORS