summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/qrscan.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2022-04-27 22:07:43 +0200
committermakefu <github@syntax-fehler.de>2022-04-27 22:07:43 +0200
commitbdd36774f5e0854553b13433ef85260c6c074b3e (patch)
tree656d0a2755c098a9e69c373a8c4f39fa82cb8d1e /krebs/5pkgs/simple/qrscan.nix
parentc3adb252afa29f0140f29c935201cfbb100b5697 (diff)
parent92d5eacd6d9e530c4d1ea0dec2652417b0fde78a (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/simple/qrscan.nix')
-rw-r--r--krebs/5pkgs/simple/qrscan.nix26
1 files changed, 3 insertions, 23 deletions
diff --git a/krebs/5pkgs/simple/qrscan.nix b/krebs/5pkgs/simple/qrscan.nix
index 7d99dcee7..df9a98053 100644
--- a/krebs/5pkgs/simple/qrscan.nix
+++ b/krebs/5pkgs/simple/qrscan.nix
@@ -1,27 +1,7 @@
-{ coreutils, gnused, writeDashBin, zbar }:
+{ pkgs }:
-writeDashBin "qrscan" ''
+pkgs.writeDashBin "qrscan" ''
set -efu
- tmpdir=$(${coreutils}/bin/mktemp --tmpdir -d qrscan.XXXXXXXX)
- codefile=$tmpdir/code
-
- cleanup() {
- ${coreutils}/bin/rm "$codefile"
- ${coreutils}/bin/rmdir "$tmpdir"
- }
-
- ${coreutils}/bin/mkfifo "$codefile"
-
- ${zbar}/bin/zbarcam > "$codefile" &
- zbarcampid=$!
-
- exec < "$codefile"
- while read -r code; do
- code=$(printf %s "$code" | ${gnused}/bin/sed -n 's/^QR-Code://p')
- if test -n "$code"; then
- ${coreutils}/bin/kill "$zbarcampid"
- echo "$code"
- fi
- done
+ ${pkgs.zbar}/bin/zbarcam -1 | ${pkgs.gnused}/bin/sed -n 's/^QR-Code://p'
''