From 797253fe537c7f862f8078947497951ef7e07309 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Sun, 5 Nov 2023 17:21:29 +0100 Subject: [PATCH] periodic wakeup from suspend --- hosts/yodaHedgehog/configuration.nix | 2 +- hosts/yodaHedgehog/host-specific.nix | 32 +++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/hosts/yodaHedgehog/configuration.nix b/hosts/yodaHedgehog/configuration.nix index b50c69a..ca7b97b 100644 --- a/hosts/yodaHedgehog/configuration.nix +++ b/hosts/yodaHedgehog/configuration.nix @@ -50,7 +50,7 @@ #../../modules/ntfs.nix #../../modules/veracrypt.nix #../../modules/btrbk - #../../modules/spin-down.nix # TODO + #../../modules/spin-down.nix ../../modules/btrfs-scrub.nix ../../modules/btrfs-mount-options.nix diff --git a/hosts/yodaHedgehog/host-specific.nix b/hosts/yodaHedgehog/host-specific.nix index 0967ef4..c5e0144 100644 --- a/hosts/yodaHedgehog/host-specific.nix +++ b/hosts/yodaHedgehog/host-specific.nix @@ -1 +1,31 @@ -{} +{ config, pkgs, ... }: + +{ + # Suspend system: + # sudo systemctl suspend + + # Power consumption: + # 2.4W powered off + # 2.6W suspended, with 1 RAM, 1 SSD + + # journalctl -u regular-wakeup + + systemd.timers."regular-wakeup" = { + wantedBy = [ "multi-user.target" ]; + timerConfig = { + OnCalendar = [ + # Testing + "Sun 16:15:00" + # Daily + # *-*-* 00:00:05 + ]; + WakeSystem = true; + }; + }; + systemd.services."regular-wakeup" = { + script = '' + set -eu -o pipefail + printf '%s%s\n' 'Wokeup at ' "$(date)" + ''; + }; +}