From f8b9bfe69b6baab93bd6453b67cb3311e34bde97 Mon Sep 17 00:00:00 2001 From: caleb Date: Sat, 16 Nov 2024 18:19:51 -0500 Subject: [PATCH] modified nvidia services to allow for combination sleep/suspend --- common/gpu/nvidia/ada-lovelace/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/gpu/nvidia/ada-lovelace/default.nix b/common/gpu/nvidia/ada-lovelace/default.nix index 461ae91..5b21702 100644 --- a/common/gpu/nvidia/ada-lovelace/default.nix +++ b/common/gpu/nvidia/ada-lovelace/default.nix @@ -7,4 +7,22 @@ in # enable the open source drivers if the package supports it hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware); + + # nvidia's hibernate, suspend, and resume services are not normally triggered on suspend-then-hibernate and hybrid-hibernate + systemd.services = { + nvidia-hibernate = { + before = [ "systemd-suspend-then-hibernate.service" ]; + wantedBy = [ "suspend-then-hibernate.target" ]; + }; + + nvidia-suspend = { + before = [ "systemd-hybrid-sleep.service" ]; + wantedBy = [ "hybrid-sleep.target" ]; + }; + + nvidia-resume = { + after = [ "systemd-suspend-then-hibernate.service" "systemd-hybrid-sleep.service" ]; + wantedBy = [ "post-resume.target" ]; + }; + }; }