aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/sc
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-02 18:28:15 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-02-02 18:28:15 +0100
commitac10559229422acf06e7c826daee3a8b1d589f7a (patch)
tree72e71570bb6b02bf18f8f017bec553ee95244624 /pkgs/by-name/sc
parentfix(modules/sound): Rename `hardware.pulseaudio` to `services.pulseaudio` (diff)
downloadnixos-config-ac10559229422acf06e7c826daee3a8b1d589f7a.zip
refactor(pkgs/screenshot_persistent): Migrate to `writeShellApplication`
`sysLib` is a good _framework_, but the overhead of the framework too much for such a simple shell script.
Diffstat (limited to 'pkgs/by-name/sc')
-rw-r--r--pkgs/by-name/sc/screenshot_persistent/package.nix10
-rwxr-xr-xpkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh8
2 files changed, 6 insertions, 12 deletions
diff --git a/pkgs/by-name/sc/screenshot_persistent/package.nix b/pkgs/by-name/sc/screenshot_persistent/package.nix
index f79315a1..4ed85c70 100644
--- a/pkgs/by-name/sc/screenshot_persistent/package.nix
+++ b/pkgs/by-name/sc/screenshot_persistent/package.nix
@@ -1,5 +1,5 @@
{
- sysLib,
+ writeShellApplication,
grim,
slurp,
alacritty,
@@ -7,12 +7,10 @@
libnotify,
lf, # TODO: add llp
}:
-sysLib.writeShellScript {
+writeShellApplication {
name = "screenshot_persistent";
- src = ./screenshot_persistent.sh;
- generateCompletions = false;
- keepPath = true;
- dependencies = [
+ text = builtins.readFile ./screenshot_persistent.sh;
+ runtimeInputs = [
grim
slurp
alacritty
diff --git a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
index 4308b8d2..f16dd46b 100755
--- a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
+++ b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh
@@ -1,10 +1,6 @@
-#! /usr/bin/env dash
+# shellcheck shell=bash
-# shellcheck source=/dev/null
-SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
-
-# only generate a path (this could lead to a time-of-check/time-of-use bug)
-tmp="$(mktmp --dry-run)"
+tmp="$(mktemp)"
if grim -g "$(slurp)" "$tmp"; then
name="$(rofi -dmenu -p "Name of screenshot: " -l 0)"