aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/hi/hibernate
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/hi/hibernate/hibernate.sh17
-rw-r--r--pkgs/by-name/hi/hibernate/package.nix9
2 files changed, 25 insertions, 1 deletions
diff --git a/pkgs/by-name/hi/hibernate/hibernate.sh b/pkgs/by-name/hi/hibernate/hibernate.sh
index 59b08ec0..5f2a524a 100755
--- a/pkgs/by-name/hi/hibernate/hibernate.sh
+++ b/pkgs/by-name/hi/hibernate/hibernate.sh
@@ -1,6 +1,17 @@
#!/usr/bin/env dash
-# TODO(@bpeetz): This functionality could be moved to `tskm`. <2025-04-14>
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
+
+# TODO(@bpeetz): The task context reset functionality could be moved to `tskm`. <2025-04-14>
+# TODO: This whole script should be a systemd service with Before=hibernate.target <2026-06-26>
context="$(task _get rc.context)"
[ "$context" ] && task context none
@@ -9,6 +20,10 @@ context="$(task _get rc.context)"
active="$(task +ACTIVE _ids)"
[ "$active" ] && task stop "$active"
+# Make sure that the swayidle service is actually running. Otherwise we don't get a
+# screenlock upon hibernate-resume.
+systemctl --user start swayidle.service
+
systemctl hibernate "$@"
# vim: ft=sh
diff --git a/pkgs/by-name/hi/hibernate/package.nix b/pkgs/by-name/hi/hibernate/package.nix
index f0fb4e96..c2e8c0b6 100644
--- a/pkgs/by-name/hi/hibernate/package.nix
+++ b/pkgs/by-name/hi/hibernate/package.nix
@@ -1,3 +1,12 @@
+# nixos-config - My current NixOS configuration
+#
+# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+# This file is part of my nixos-config.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
writeShellApplication,
systemd,