From 7ce3a9fb705f37a780fef62f3ed1cc9451ce23a8 Mon Sep 17 00:00:00 2001
From: Dmitriy Pleshevskiy <dmitriy@pleshevski.ru>
Date: Mon, 10 Mar 2025 22:52:11 +0300
Subject: [PATCH] host/home: configure hibernation

---
 hosts/home/hardware-configuration/default.nix     |  1 +
 hosts/home/hardware-configuration/hibernation.nix | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 hosts/home/hardware-configuration/hibernation.nix

diff --git a/hosts/home/hardware-configuration/default.nix b/hosts/home/hardware-configuration/default.nix
index 7bc9170..c384e14 100644
--- a/hosts/home/hardware-configuration/default.nix
+++ b/hosts/home/hardware-configuration/default.nix
@@ -3,6 +3,7 @@
 {
   imports = [
     ./generated.nix # Include the results of the hardware scan.
+    ./hibernation.nix
     ./nfs.nix
   ];
 
diff --git a/hosts/home/hardware-configuration/hibernation.nix b/hosts/home/hardware-configuration/hibernation.nix
new file mode 100644
index 0000000..6581497
--- /dev/null
+++ b/hosts/home/hardware-configuration/hibernation.nix
@@ -0,0 +1,15 @@
+{...}:
+
+{
+  swapDevices = [
+    {
+      device = "/var/lib/swapfile";
+      size = 64 * 1024;
+    }
+  ];
+
+  boot.resumeDevice = "/dev/disk/by-uuid/969c5f68-631d-4429-b81b-0d81e050449b";
+  boot.kernelParams = [ "resume_offset=156735488" ];
+
+  powerManagement.enable = true;
+}
-- 
2.48.1