aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/hi
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xpkgs/by-name/hi/hibernate/hibernate.sh18
-rw-r--r--pkgs/by-name/hi/hibernate/package.nix24
2 files changed, 32 insertions, 10 deletions
diff --git a/pkgs/by-name/hi/hibernate/hibernate.sh b/pkgs/by-name/hi/hibernate/hibernate.sh
index 30868fd1..5f2a524a 100755
--- a/pkgs/by-name/hi/hibernate/hibernate.sh
+++ b/pkgs/by-name/hi/hibernate/hibernate.sh
@@ -1,7 +1,17 @@
#!/usr/bin/env dash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# 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
@@ -10,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 24754f09..c2e8c0b6 100644
--- a/pkgs/by-name/hi/hibernate/package.nix
+++ b/pkgs/by-name/hi/hibernate/package.nix
@@ -1,15 +1,23 @@
+# 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>.
{
- sysLib,
+ writeShellApplication,
systemd,
- taskwarrior,
+ taskwarrior3,
}:
-sysLib.writeShellScript {
+writeShellApplication {
name = "hibernate";
- src = ./hibernate.sh;
- generateCompletions = false;
- keepPath = false;
- dependencies = [
+ text = builtins.readFile ./hibernate.sh;
+ inheritPath = false;
+ runtimeInputs = [
systemd
- taskwarrior
+ taskwarrior3
];
}