From 204731c0a69136c9cebcb54f1afecf5145e26bbe Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 23 May 2024 13:26:22 +0200 Subject: refactor(pkgs): Categorize into `by-name` shards This might not be the perfect way to organize a package set -- especially if the set is not nearly the size of nixpkgs -- but it is _at_ least a way of organization. --- pkgs/by-name/hi/hibernate/hibernate.sh | 15 +++++++++++++++ pkgs/by-name/hi/hibernate/package.nix | 15 +++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 pkgs/by-name/hi/hibernate/hibernate.sh create mode 100644 pkgs/by-name/hi/hibernate/package.nix (limited to 'pkgs/by-name/hi') diff --git a/pkgs/by-name/hi/hibernate/hibernate.sh b/pkgs/by-name/hi/hibernate/hibernate.sh new file mode 100755 index 00000000..30868fd1 --- /dev/null +++ b/pkgs/by-name/hi/hibernate/hibernate.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH + +context="$(task _get rc.context)" +[ "$context" ] && task context none + +# We have ensured that only one task is active +active="$(task +ACTIVE _ids)" +[ "$active" ] && task stop "$active" + +systemctl hibernate "$@" + +# vim: ft=sh diff --git a/pkgs/by-name/hi/hibernate/package.nix b/pkgs/by-name/hi/hibernate/package.nix new file mode 100644 index 00000000..24754f09 --- /dev/null +++ b/pkgs/by-name/hi/hibernate/package.nix @@ -0,0 +1,15 @@ +{ + sysLib, + systemd, + taskwarrior, +}: +sysLib.writeShellScript { + name = "hibernate"; + src = ./hibernate.sh; + generateCompletions = false; + keepPath = false; + dependencies = [ + systemd + taskwarrior + ]; +} -- cgit 1.4.1