summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/lo/lock
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/lo/lock')
-rwxr-xr-xpkgs/by-name/lo/lock/lock.sh21
-rw-r--r--pkgs/by-name/lo/lock/package.nix15
-rw-r--r--pkgs/by-name/lo/lock/package.unstable.nix25
3 files changed, 39 insertions, 22 deletions
diff --git a/pkgs/by-name/lo/lock/lock.sh b/pkgs/by-name/lo/lock/lock.sh
index 3101ef9a..1c068e57 100755
--- a/pkgs/by-name/lo/lock/lock.sh
+++ b/pkgs/by-name/lo/lock/lock.sh
@@ -1,18 +1,25 @@
-#!/usr/bin/env dash
+# 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>.
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
+# shellcheck shell=bash
context="$(task _get rc.context)"
-[ "$context" ] && task context none
+[ -n "$context" ] && task context none
# We have ensured that only one task is active
active="$(task +ACTIVE _ids)"
-[ "$active" ] && task stop "$active"
+[ -n "$active" ] && task stop "$active"
swaylock
-[ "$active" ] && task start "$active"
+[ -n "$active" ] && task start "$active"
-[ "$context" ] && task context "$context"
+[ -n "$context" ] && task context "$context"
# vim: ft=sh
diff --git a/pkgs/by-name/lo/lock/package.nix b/pkgs/by-name/lo/lock/package.nix
deleted file mode 100644
index 0e6e38d0..00000000
--- a/pkgs/by-name/lo/lock/package.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- sysLib,
- taskwarrior,
- swaylock,
-}:
-sysLib.writeShellScript {
- name = "lock";
- src = ./lock.sh;
- generateCompletions = false;
- keepPath = false;
- dependencies = [
- taskwarrior
- swaylock
- ];
-}
diff --git a/pkgs/by-name/lo/lock/package.unstable.nix b/pkgs/by-name/lo/lock/package.unstable.nix
new file mode 100644
index 00000000..572ebb0b
--- /dev/null
+++ b/pkgs/by-name/lo/lock/package.unstable.nix
@@ -0,0 +1,25 @@
+# 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,
+ taskwarrior3,
+ swaylock,
+}:
+writeShellApplication {
+ name = "lock";
+ text = builtins.readFile ./lock.sh;
+ runtimeInputs = [
+ taskwarrior3
+ swaylock
+ ];
+ meta = {
+ mainProgram = "lock";
+ };
+}