style
Some checks failed
Basic Code Checks / formatting-check (push) Has been cancelled

Signed-off-by: gwg313 <gwg313@pm.me>
This commit is contained in:
gwg313 2025-07-03 10:34:00 -04:00
parent 4c0e29da8f
commit bb2fe56082
Signed by: gwg313
GPG key ID: 60FF63B4826B7400
40 changed files with 595 additions and 1144 deletions

View file

@ -34,6 +34,8 @@
./sysctl.nix
./earlyoom.nix
./sleep.nix
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd

34
hosts/grymforge/sleep.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
systemd.services.sleep-schedule = {
description = "Suspend PC at 10PM and wake at 6:30AM using rtcwake";
serviceConfig = {
Type = "oneshot";
ExecStart = pkgs.writeShellScript "sleep-schedule" ''
WAKE_TIME=$(${pkgs.coreutils}/bin/date +%s -d "tomorrow 06:30")
exec ${pkgs.util-linux}/bin/rtcwake -m mem -t "$WAKE_TIME"
'';
};
};
systemd.timers.sleep-schedule = {
description = "Timer to suspend PC at 10PM daily";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "daily 22:00";
Persistent = true;
};
};
security.sudo.extraRules = [
{
users = [ "root" ];
commands = [
{
command = "/run/current-system/sw/bin/rtcwake";
options = [ "NOPASSWD" ];
}
];
}
];
}