From 15347b8879bfadeded9c2d8beefa880413cb9fb8 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Thu, 27 Feb 2025 17:21:44 +0200 Subject: Added systemd timer to automatically track sleeping schedule (technically tracks when the PC is on/off) --- hosts/kyren-laptop/configuration.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'hosts') diff --git a/hosts/kyren-laptop/configuration.nix b/hosts/kyren-laptop/configuration.nix index 82b2248..2e86d95 100644 --- a/hosts/kyren-laptop/configuration.nix +++ b/hosts/kyren-laptop/configuration.nix @@ -177,10 +177,21 @@ pkgs.keychain pkgs.openssh ]; - serviceConfig = { - Type = "oneshot"; - User = "kyren"; - }; + serviceConfig = { Type = "oneshot"; User = "kyren"; }; + }; + + systemd.timers."k-sleep-tracker" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "1m"; + OnUnitActiveSec = "1m"; + Unit = "k-sleep-tracker.service"; + }; + }; + + systemd.services."k-sleep-tracker" = { + script = "$HOME/projects/k/bin/k tracker sleep"; + serviceConfig = { Type = "oneshot"; User = "kyren"; }; }; # Enable KVM/QEMU virtualization -- cgit v1.3.1