diff options
author | makefu <github@syntax-fehler.de> | 2022-04-27 22:07:43 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2022-04-27 22:07:43 +0200 |
commit | bdd36774f5e0854553b13433ef85260c6c074b3e (patch) | |
tree | 656d0a2755c098a9e69c373a8c4f39fa82cb8d1e /krebs/5pkgs/simple | |
parent | c3adb252afa29f0140f29c935201cfbb100b5697 (diff) | |
parent | 92d5eacd6d9e530c4d1ea0dec2652417b0fde78a (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r-- | krebs/5pkgs/simple/git-hooks/default.nix | 7 | ||||
-rw-r--r-- | krebs/5pkgs/simple/pager.nix | 36 | ||||
-rw-r--r-- | krebs/5pkgs/simple/qrscan.nix | 26 | ||||
-rw-r--r-- | krebs/5pkgs/simple/untilport/default.nix | 2 |
4 files changed, 46 insertions, 25 deletions
diff --git a/krebs/5pkgs/simple/git-hooks/default.nix b/krebs/5pkgs/simple/git-hooks/default.nix index c9dcc7541..3ec43739c 100644 --- a/krebs/5pkgs/simple/git-hooks/default.nix +++ b/krebs/5pkgs/simple/git-hooks/default.nix @@ -96,7 +96,12 @@ with stockholm.lib; #$host $GIT_SSH_REPO $ref $link add_message $(pink push) $link $(gray "($receive_mode)") - ${optionalString verbose /* sh */ '' + ${optionalString (verbose == true || typeOf verbose == "set") /* sh */ '' + ${optionalString (verbose.exclude or [] != []) /* sh */ '' + case $ref in (${concatStringsSep "|" verbose.exclude}) + continue + esac + ''} add_message "$( git log \ --format="$(orange %h) %s $(gray '(%ar)')" \ diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix new file mode 100644 index 000000000..ed740490d --- /dev/null +++ b/krebs/5pkgs/simple/pager.nix @@ -0,0 +1,36 @@ +{ pkgs }: + +pkgs.writeDashBin "pager" '' + # usage: pager {view,shift,shiftview} + # + # Environment variables + # + # PAGER_NAME (default: Pager) + # The environment variables specifies the application name under which + # resources are to be obtained. PAGER_NAME should not contain “.” or “*” + # characters. + # + set -efu + + pidfile=$XDG_RUNTIME_DIR/pager.lock + name=''${PAGER_NAME-Pager} + + if test -e "$pidfile" && + ${pkgs.procps}/bin/pgrep --pidfile="$pidfile" >/dev/null + then + ${pkgs.procps}/bin/pkill --pidfile="$pidfile" + ${pkgs.coreutils}/bin/rm "$pidfile" + exit + fi + + echo $$ > "$pidfile" + + exec ${pkgs.xterm}/bin/xterm \ + -name "$name" \ + -ti vt340 \ + -xrm 'Pager*geometry: 32x10' \ + -xrm 'Pager*internalBorder: 2' \ + -xrm 'Pager*background: #050505' \ + -xrm 'Pager*foreground: #d0d7d0' \ + -e ${pkgs.haskellPackages.pager}/bin/pager "$@" +'' 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' '' diff --git a/krebs/5pkgs/simple/untilport/default.nix b/krebs/5pkgs/simple/untilport/default.nix index 61bcc2b89..2930fd1eb 100644 --- a/krebs/5pkgs/simple/untilport/default.nix +++ b/krebs/5pkgs/simple/untilport/default.nix @@ -13,6 +13,6 @@ pkgs.writeDashBin "untilport" '' if [ $# -ne 2 ]; then usage else - until ${pkgs.netcat-openbsd}/bin/nc -z "$@"; do sleep 1; done + until ${pkgs.libressl.nc}/bin/nc -z "$@"; do sleep 1; done fi '' |