summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-02-07 14:34:51 +0100
committertv <tv@krebsco.de>2023-02-07 19:44:52 +0100
commite26b6d1f1546d48a482bd2a63c0113164eabb169 (patch)
treedcbbabb2a5836cdec8db18fb27730a80c71b3ec5
parent1ce5e46e7b56d7da09802b909d74b6b3439710a8 (diff)
pager: expose utilities
-rw-r--r--krebs/5pkgs/simple/pager.nix66
1 files changed, 36 insertions, 30 deletions
diff --git a/krebs/5pkgs/simple/pager.nix b/krebs/5pkgs/simple/pager.nix
index ed740490d..f183dd1dc 100644
--- a/krebs/5pkgs/simple/pager.nix
+++ b/krebs/5pkgs/simple/pager.nix
@@ -1,36 +1,42 @@
{ 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
+pkgs.symlinkJoin {
+ name = "pager-wrapper";
+ paths = [
+ (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}
+ 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
+ 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"
+ 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 "$@"
-''
+ 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 "$@"
+ '')
+ pkgs.haskellPackages.pager
+ ];
+}