diff options
Diffstat (limited to 'tv/5pkgs/simple')
29 files changed, 0 insertions, 1378 deletions
diff --git a/tv/5pkgs/simple/bash-fzf-history.nix b/tv/5pkgs/simple/bash-fzf-history.nix deleted file mode 100644 index 88a8e9e4..00000000 --- a/tv/5pkgs/simple/bash-fzf-history.nix +++ /dev/null @@ -1,102 +0,0 @@ -with import <stockholm/lib>; -{ pkgs - -, edit-key ? "ctrl-e" -, exec-key ? "enter" -, edit-mark ? "${mark-prefix}${edit-key}" -, exec-mark ? "${mark-prefix}${exec-key}" -, edit-command ? "\"\"" -, exec-command ? "accept-line" -, mark-prefix ? " #FZFKEY:" -, finish-keyseq ? "\\C-x\\C-p" -, rebind-keyseq ? "\\C-x\\C-o" - -, start-keyseq ? "\\C-f" -, load-keyseq ? start-keyseq -}: let - script = pkgs.writeBash "bash-fzf-history.sh" '' - if ! command -v fzf >/dev/null; then - # Alternatively rewrite ${pkgs.fzf}/share/fzf/* to use absolute paths. - fzf() { - ${pkgs.fzf}/bin/fzf "$@" - } - fi - - . ${pkgs.fzf}/share/fzf/key-bindings.bash - . ${pkgs.fzf}/share/fzf/completion.bash - - FZF_DEFAULT_OPTS='${toString [ - /* sh */ "--height=40%" - /* sh */ "--inline-info" - /* sh */ "--min-height=4" - /* sh */ "--reverse" - ]}' - - __fzf_history__() ( - IFS=$'\n' - result=( $( - # To add "unknown timestamps" to each line of the history: - # sed -i '/^#[0-9]/{n;b};s/^/#1\n/' "$HISTFILE" - HISTTIMEFORMAT=$'\e[38;5;244m%Y-%m-%dT%H:%M:%S\e[m ' history | - ${pkgs.gnused}/bin/sed ' - s/\(\x1b\[[0-9;]*\)244m1970-[0-9T:-]*/\1237m????-??-??T??:??:??/ - ' | - FZF_DEFAULT_OPTS="${toString [ - /* sh */ "--ansi" - /* sh */ "--tac" - /* sh */ "--sync" - /* sh */ "-n2..,.." - /* sh */ "--tiebreak=index" - /* sh */ "--bind=ctrl-r:toggle-sort" - /* sh */ "--expect=${edit-key},${exec-key}" - /* sh */ "$FZF_DEFAULT_OPTS" - /* sh */ "+m" - ]}" \ - ${pkgs.fzf}/bin/fzf | - ${pkgs.gnused}/bin/sed ' - /^ *[0-9]/{ - s/^ *// - s/ \+/\n/;# index - s/ \+/\n/;# date - } - ' - ) ) - if test -n "$result"; then - key=''${result[0]} - index=''${result[1]} - date=''${result[2]} - command=''${result[3]} - - echo "$command${mark-prefix}$key" - else - # Ensure no empty new line gets produced when fzf was aborted. - echo '${edit-mark}' - fi - ) - - __fzf_rebind_finish_keyseq__() { - local suffix= - case $READLINE_LINE in - *'${edit-mark}') - suffix='${edit-mark}' - bind '"${finish-keyseq}": ${edit-command}' - ;; - *'${exec-mark}') - suffix='${exec-mark}' - bind '"${finish-keyseq}": ${exec-command}' - ;; - esac - READLINE_LINE=${"\${READLINE_LINE:0:-\${#suffix}}"} - } - bind -x '"${rebind-keyseq}": __fzf_rebind_finish_keyseq__' - - bind '"\C-r": reverse-search-history' - bind '"${start-keyseq}": " \C-e\C-u\C-y\ey\C-u`__fzf_history__`\e\C-e\er\e^${rebind-keyseq}${finish-keyseq}"' - - echo '# fzf key bindings loaded:' >&2 - bind -s | ${pkgs.gnugrep}/bin/grep __fzf_ >&2 - ''; -in - script.overrideAttrs (old: rec { - bind = /* sh */ ''bind -x '"${load-keyseq}": . ${script}' ''; - }) diff --git a/tv/5pkgs/simple/cr.nix b/tv/5pkgs/simple/cr.nix deleted file mode 100644 index 048d7795..00000000 --- a/tv/5pkgs/simple/cr.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs }: - -pkgs.writeDashBin "cr" '' - set -efu - if test -n "''${XDG_RUNTIME_DIR-}"; then - cache_dir=$XDG_RUNTIME_DIR/chromium-disk-cache - else - cache_dir=/tmp/chromium-disk-cache_$LOGNAME - fi - export LC_TIME=de_DE.utf8 - exec ${pkgs.chromium}/bin/chromium \ - --ssl-version-min=tls1 \ - --disk-cache-dir="$cache_dir" \ - --disk-cache-size=50000000 \ - "$@" -'' diff --git a/tv/5pkgs/simple/default.nix b/tv/5pkgs/simple/default.nix deleted file mode 100644 index 9fb45dd1..00000000 --- a/tv/5pkgs/simple/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -with import ../../../lib; - -self: super: - -let - # This callPackage will try to detect obsolete overrides. - callPackage = path: args: let - override = self.callPackage path args; - upstream = optionalAttrs (override ? "name") - (super.${(parseDrvName override.name).name} or {}); - in if upstream ? "name" && - override ? "name" && - compareVersions upstream.name override.name != -1 - then trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override - else override; -in - - mapNixDir (path: callPackage path {}) ./. diff --git a/tv/5pkgs/simple/diff-so-fancy.nix b/tv/5pkgs/simple/diff-so-fancy.nix deleted file mode 100644 index d57e6e75..00000000 --- a/tv/5pkgs/simple/diff-so-fancy.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ fetchFromGitHub, lib, stdenv -, coreutils, git, makeWrapper, ncurses, perl -}: - -stdenv.mkDerivation rec { - name = "diff-so-fancy-${version}"; - version = "ed8cf17"; - - src = fetchFromGitHub { - owner = "so-fancy"; - repo = "diff-so-fancy"; - rev = "ed8cf1763d38bdd79ceb55a73b9ce7e30f1e184d"; - sha256 = "176qn0w2rn6mr5ymvkblyiznqq7yyibfsnnjfivcyhz69w6yr9r9"; - }; - - # Perl is needed here for patchShebangs - nativeBuildInputs = [ perl makeWrapper ]; - - buildPhase = null; - - installPhase = '' - mkdir -p $out/bin $out/lib/diff-so-fancy - - # diff-so-fancy executable searches for it's library relative to - # itself, so we are copying executable to lib, and only symlink it - # from bin/ - cp diff-so-fancy $out/lib/diff-so-fancy - cp -r lib $out/lib/diff-so-fancy - ln -s $out/lib/diff-so-fancy/diff-so-fancy $out/bin - - # ncurses is needed for `tput` - wrapProgram $out/lib/diff-so-fancy/diff-so-fancy \ - --prefix PATH : "${git}/share/git/contrib/diff-highlight" \ - --prefix PATH : "${git}/bin" \ - --prefix PATH : "${coreutils}/bin" \ - --prefix PATH : "${ncurses.out}/bin" - ''; - - meta = with lib; { - homepage = https://github.com/so-fancy/diff-so-fancy; - description = "Good-looking diffs filter for git"; - license = licenses.mit; - platforms = platforms.all; - longDescription = '' - diff-so-fancy builds on the good-lookin' output of git contrib's - diff-highlight to upgrade your diffs' appearances. - ''; - maintainers = with maintainers; [ fpletz ]; - }; -} diff --git a/tv/5pkgs/simple/disko.nix b/tv/5pkgs/simple/disko.nix deleted file mode 100644 index de8f1df2..00000000 --- a/tv/5pkgs/simple/disko.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ fetchgit }: - -let - src = fetchgit { - url = https://cgit.krebsco.de/disko; - rev = "16cd458af06d3caf687eb7d80ca3df26b71fe28c"; - sha256 = "16cd458af06d3caf687eb7d80ca3df26b71fe28c"; - }; -in - -{ - lib = import "${src}/lib"; -} diff --git a/tv/5pkgs/simple/editor-input.nix b/tv/5pkgs/simple/editor-input.nix deleted file mode 100644 index 931179af..00000000 --- a/tv/5pkgs/simple/editor-input.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs }: -pkgs.writeDashBin "editor-input" '' - exec \ - ${pkgs.utillinux}/bin/setsid -f \ - ${pkgs.with-tmpdir}/bin/with-tmpdir -t editor-input.XXXXXXXX \ - ${pkgs.writeDash "editor-input.sh" '' - f=$TMPDIR/input - ${pkgs.rxvt_unicode}/bin/urxvt -name editor-input-urxvt -e \ - ${pkgs.vim}/bin/vim --cmd ':set noeol binary' -c startinsert "$f" - if test -e "$f"; then - ${pkgs.xsel}/bin/xsel -ip < "$f" - ${pkgs.xsel}/bin/xsel -ib < "$f" - ${pkgs.xdotool}/bin/xdotool key --clearmodifiers shift+Insert - ${pkgs.xsel}/bin/xsel -dp - ${pkgs.xsel}/bin/xsel -db - fi - ''} -'' diff --git a/tv/5pkgs/simple/ff.nix b/tv/5pkgs/simple/ff.nix deleted file mode 100644 index 4ce9c3c7..00000000 --- a/tv/5pkgs/simple/ff.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ pkgs }: - -pkgs.writeDashBin "ff" '' - exec ${pkgs.firefox}/bin/firefox "$@" -'' diff --git a/tv/5pkgs/simple/field.nix b/tv/5pkgs/simple/field.nix deleted file mode 100644 index 71362398..00000000 --- a/tv/5pkgs/simple/field.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ gawk, writeDashBin }: - -writeDashBin "field" '' - set -u - exec ${gawk}/bin/awk -v n="$1" '{print$n}' -'' diff --git a/tv/5pkgs/simple/fzmenu/bin/otpmenu b/tv/5pkgs/simple/fzmenu/bin/otpmenu deleted file mode 100755 index ad8a0fda..00000000 --- a/tv/5pkgs/simple/fzmenu/bin/otpmenu +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -set -efu - -#PATH= - -case ${FZMENU_PHASE-0} in - 0) - export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" - ;; - 1) - if result=$( - FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} - if test -n "$FZF_DEFAULT_OPTS"; then - export FZF_DEFAULT_OPTS - fi - pass git ls-files '*/otp.gpg' | \ - sed ' - - s/\/otp\.gpg$// - ' | - exec fzf \ - --history=/dev/null \ - --no-sort \ - --prompt='OTP: ' \ - ) - then - export FZMENU_PHASE=2 - export FZMENU_RESULT="$result" - setsid -f "$0" - fi - ;; - 2) - pass=$(pass otp code "$FZMENU_RESULT/otp") - printf %s "$pass" | - xdotool type -f - - ;; - *) - echo "$0: error: bad phase: $FZMENU_PHASE" >&2 - exit -1 -esac diff --git a/tv/5pkgs/simple/fzmenu/bin/passmenu b/tv/5pkgs/simple/fzmenu/bin/passmenu deleted file mode 100755 index 00b36c3a..00000000 --- a/tv/5pkgs/simple/fzmenu/bin/passmenu +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -set -efu - -#PATH= - -case ${FZMENU_PHASE-0} in - 0) - export FZMENU_PHASE=1 - exec setsid -f urxvt -name fzmenu-urxvt -e dash "$0" - ;; - 1) - if result=$( - FZF_DEFAULT_OPTS=${FZMENU_FZF_DEFAULT_OPTS-} - if test -n "$FZF_DEFAULT_OPTS"; then - export FZF_DEFAULT_OPTS - fi - pass git ls-files '*/*.gpg' | \ - sed ' - /\/otp\.gpg$:/d - s/\.gpg$// - ' | - exec fzf \ - --history=/dev/null \ - --no-sort \ - --prompt='pass: ' \ - ) - then - export FZMENU_PHASE=2 - export FZMENU_RESULT="$result" - setsid -f "$0" - fi - ;; - 2) - pass=$(pass show "$FZMENU_RESULT") - printf %s "$pass" | - xdotool type -f - - ;; - *) - echo "$0: error: bad phase: $FZMENU_PHASE" >&2 - exit -1 -esac diff --git a/tv/5pkgs/simple/fzmenu/default.nix b/tv/5pkgs/simple/fzmenu/default.nix deleted file mode 100644 index 634d8338..00000000 --- a/tv/5pkgs/simple/fzmenu/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ lib, pkgs, stdenv }: - -pkgs.runCommand "fzmenu" { -} /* sh */ '' - mkdir $out - - cp -r ${./bin} $out/bin - - substituteInPlace $out/bin/otpmenu \ - --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \ - --replace '#PATH=' PATH=${lib.makeBinPath [ - pkgs.coreutils - pkgs.dash - pkgs.fzf - pkgs.gnused - (pkgs.pass.withExtensions (ext: [ - ext.pass-otp - ])) - pkgs.rxvt_unicode - pkgs.utillinux - pkgs.xdotool - ]} - - substituteInPlace $out/bin/passmenu \ - --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \ - --replace '#PATH=' PATH=${lib.makeBinPath [ - pkgs.coreutils - pkgs.dash - pkgs.fzf - pkgs.gnused - (pkgs.pass.withExtensions (ext: [ - ext.pass-otp - ])) - pkgs.rxvt_unicode - pkgs.utillinux - pkgs.xdotool - ]} -'' diff --git a/tv/5pkgs/simple/hc.nix b/tv/5pkgs/simple/hc.nix deleted file mode 100644 index 086445ec..00000000 --- a/tv/5pkgs/simple/hc.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ fetchgit, lib, makeWrapper, stdenv -, coreutils, findutils, gawk, gnugrep, qrencode, texlive, utillinux, zbar -}: - -stdenv.mkDerivation rec { - name = "hc-${meta.version}"; - - src = fetchgit { - url = "https://cgit.krebsco.de/hc"; - rev = "refs/tags/v${meta.version}"; - sha256 = "09349gja22p0j3xs082kp0fnaaada14bafszn4r3q7rg1id2slfb"; - }; - - nativeBuildInputs = [ makeWrapper ]; - - buildPhase = null; - - installPhase = '' - mkdir -p $out/bin - - cp $src/bin/hc $out/bin/hc - - wrapProgram $out/bin/hc \ - --prefix PATH : ${lib.makeBinPath [ - coreutils - findutils - gawk - gnugrep - qrencode - texlive.combined.scheme-full - utillinux - zbar - ]} - ''; - - meta = { - version = "1.0.0"; - }; -} diff --git a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix b/tv/5pkgs/simple/imagescan-plugin-networkscan.nix deleted file mode 100644 index c3f2deac..00000000 --- a/tv/5pkgs/simple/imagescan-plugin-networkscan.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ fetchurl, lib, pkgs, stdenv }: - -stdenv.mkDerivation rec { - pname = "imagescan-plugin-networkscan"; - version = "1.1.3"; - - src = - if stdenv.system == "x86_64-linux" then - fetchurl { - urls = [ - "https://download2.ebz.epson.net/imagescanv3/debian/latest1/deb/x64/imagescan-bundle-debian-10-3.63.0.x64.deb.tar.gz" - "http://ni.r/~tv/mirrors/epson/imagescan-bundle-debian-10-3.63.0.x64.deb.tar.gz" - ]; - hash = "sha256:1rbz6mjfinag7c2vnyl7lls3gpn8n91sv0p18ilnbw0vaddssn4j"; - } - else throw "${pname} is not supported on ${stdenv.system}; supported systems: x86_64-linux"; - - dontBuild = true; - - nativeBuildInputs = [ - pkgs.dpkg - ]; - - installPhase = '' - # Wildcard * stand for either i386 or amd64 - dpkg -x \ - plugins/imagescan-plugin-networkscan_${version}-1epson4debian10_*.deb \ - tmp - - mv tmp/usr $out - ''; - - preFixup = '' - patchelf --set-interpreter \ - ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \ - $out/lib/utsushi/networkscan - - # libstdc++.so.6 - patchelf --set-rpath \ - ${stdenv.cc.cc.lib}/lib \ - $out/lib/utsushi/networkscan - ''; - - meta = { - description = "Epson Image Scan v3 networkscan plugin"; - longDescription = '' - This package provides the unfree networkscan plugin from the Epson - Image Scan v3 scanner driver bundle, which can be used by Utsushi. - ''; - homepage = "http://support.epson.net/linux/en/imagescanv3.php?version=${version}"; - license = lib.licenses.eapl; - maintainers = [ lib.maintainers.tv ]; - platforms = lib.platforms.linux; - }; -} diff --git a/tv/5pkgs/simple/mpvterm/default.nix b/tv/5pkgs/simple/mpvterm/default.nix deleted file mode 100644 index 66ad08a7..00000000 --- a/tv/5pkgs/simple/mpvterm/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs }: - -pkgs.mpv-unwrapped.overrideAttrs (old: rec { - pname = "mpvterm"; - patches = old.patches or [] ++ [ - ./mpvterm.patch - ]; -}) diff --git a/tv/5pkgs/simple/mpvterm/mpvterm.patch b/tv/5pkgs/simple/mpvterm/mpvterm.patch deleted file mode 100644 index 12636880..00000000 --- a/tv/5pkgs/simple/mpvterm/mpvterm.patch +++ /dev/null @@ -1,146 +0,0 @@ -commit 5ded4dac370ce5d8d727c5d3891448f942edbfdf -Author: tv <tv@krebsco.de> -Date: Sat Feb 27 22:54:55 2021 +0100 - - x11: add input forwarding support - -diff --git a/video/out/x11_common.c b/video/out/x11_common.c -index ac551fae8e..2e95451d7f 100644 ---- a/video/out/x11_common.c -+++ b/video/out/x11_common.c -@@ -25,6 +25,10 @@ - #include <string.h> - #include <assert.h> - -+#include <stdarg.h> -+#include <sys/socket.h> -+#include <sys/un.h> -+ - #include <X11/Xmd.h> - #include <X11/Xlib.h> - #include <X11/Xutil.h> -@@ -1097,6 +1101,73 @@ static void release_all_keys(struct vo *vo) - x11->win_drag_button1_down = false; - } - -+ -+#define FORWARD_START 1 -+#define FORWARD_READY 2 -+#define FORWARD_ERROR 3 -+static int forward_state = FORWARD_START; -+static int forward_fd, forward_len; -+static struct sockaddr_un forward_un; -+static char forward_buf[BUFSIZ]; -+ -+static void forward_start(void) { -+ const char *socket_path = getenv("FORWARD_SOCKET"); -+ if (socket_path == NULL) { -+ fprintf(stderr, "forward_start: environment variable FORWARD_SOCKET not set\n"); -+ forward_state = FORWARD_ERROR; -+ return; -+ } -+ -+ if ((forward_fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) { -+ perror("socket"); -+ } else { -+ memset(&forward_un, 0, sizeof(forward_un)); -+ forward_un.sun_family = AF_UNIX; -+ strcpy(forward_un.sun_path, socket_path); -+ forward_len = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); -+ forward_state = FORWARD_READY; -+ } -+} -+static void forward_send(const char *fmt, ...) { -+ if (forward_state != FORWARD_READY) return; -+ -+ va_list argp; -+ va_start(argp, fmt); -+ int n1 = vsnprintf(forward_buf, BUFSIZ, fmt, argp); -+ if (n1 < BUFSIZ + 1) { -+ forward_buf[n1++] = '\n'; -+ forward_buf[n1] = '\0'; -+ int n2 = sendto(forward_fd, forward_buf, n1, 0, (struct sockaddr *)&forward_un, forward_len); -+ if (n2 < 0) { -+ perror("sendto"); -+ } -+ } -+} -+static const char *forward_keyname(KeySym keySym) { -+ const char *name; -+ if (keySym == NoSymbol) { -+ name = "NoSymbol"; -+ } else if (!(name = XKeysymToString(keySym))) { -+ name = "NoName"; -+ } -+ return name; -+} -+static void forward_keydown(KeySym keySym) { -+ forward_send("xdotool keydown %s", forward_keyname(keySym)); -+} -+static void forward_keyup(KeySym keySym) { -+ forward_send("xdotool keyup %s", forward_keyname(keySym)); -+} -+static void forward_mousedown(int button) { -+ forward_send("xdotool mousedown %d", button); -+} -+static void forward_mouseup(int button) { -+ forward_send("xdotool mouseup %d", button); -+} -+static void forward_mousemove(int x, int y) { -+ forward_send("xdotool mousemove %d %d", x, y); -+} -+ - void vo_x11_check_events(struct vo *vo) - { - struct vo_x11_state *x11 = vo->x11; -@@ -1105,6 +1176,10 @@ void vo_x11_check_events(struct vo *vo) - - xscreensaver_heartbeat(vo->x11); - -+ if (forward_state == FORWARD_START) { -+ forward_start(); -+ } -+ - while (XPending(display)) { - XNextEvent(display, &Event); - MP_TRACE(x11, "XEvent: %d\n", Event.type); -@@ -1146,6 +1221,7 @@ void vo_x11_check_events(struct vo *vo) - if (mpkey) - mp_input_put_key(x11->input_ctx, mpkey | modifiers); - } -+ forward_keydown(XLookupKeysym(&Event.xkey, 0)); - break; - } - case FocusIn: -@@ -1161,6 +1237,7 @@ void vo_x11_check_events(struct vo *vo) - break; - case KeyRelease: - release_all_keys(vo); -+ forward_keyup(XLookupKeysym(&Event.xkey, 0)); - break; - case MotionNotify: - if (x11->win_drag_button1_down && !x11->fs && -@@ -1182,6 +1259,7 @@ void vo_x11_check_events(struct vo *vo) - Event.xmotion.y); - } - x11->win_drag_button1_down = false; -+ forward_mousemove(Event.xmotion.x, Event.xmotion.y); - break; - case LeaveNotify: - if (Event.xcrossing.mode != NotifyNormal) -@@ -1204,6 +1282,7 @@ void vo_x11_check_events(struct vo *vo) - get_mods(Event.xbutton.state) | MP_KEY_STATE_DOWN); - long msg[4] = {XEMBED_REQUEST_FOCUS}; - vo_x11_xembed_send_message(x11, msg); -+ forward_mousedown(Event.xbutton.button); - break; - case ButtonRelease: - if (Event.xbutton.button - 1 >= MP_KEY_MOUSE_BTN_COUNT) -@@ -1213,6 +1292,7 @@ void vo_x11_check_events(struct vo *vo) - mp_input_put_key(x11->input_ctx, - (MP_MBTN_BASE + Event.xbutton.button - 1) | - get_mods(Event.xbutton.state) | MP_KEY_STATE_UP); -+ forward_mouseup(Event.xbutton.button); - break; - case MapNotify: - x11->window_hidden = false; diff --git a/tv/5pkgs/simple/pinentry-urxvt/default.nix b/tv/5pkgs/simple/pinentry-urxvt/default.nix deleted file mode 100644 index 65b76c07..00000000 --- a/tv/5pkgs/simple/pinentry-urxvt/default.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ pkgs, ... }@args: - -let - lib = import <stockholm/lib>; - - # config cannot be declared in the input attribute set because that would - # cause callPackage to inject the wrong config. Instead, get it from ... - # via args. - config = args.config or {}; - - cfg = eval.config; - - eval = lib.evalModules { - modules = lib.singleton { - _file = toString ./default.nix; - imports = lib.singleton config; - options = { - appName = lib.mkOption { - default = "pinentry-urxvt"; - type = lib.types.str; - }; - display = lib.mkOption { - default = ":0"; - type = lib.types.str; - }; - }; - }; - }; - - -in - - pkgs.write "pinentry-urxvt" { - "/bin/pinentry".link = pkgs.writeDash "pinentry-urxvt-wrapper" '' - set -efu - exec 3<&0 4>&1 5>&2 - export DISPLAY=${lib.shell.escape cfg.display} - exec ${pkgs.rxvt_unicode}/bin/urxvt \ - -name ${lib.shell.escape cfg.appName} \ - -e ${pkgs.writeDash "pinentry-urxvt-tty" '' - set -efu - exec 2>&5 - TTY=$(${pkgs.coreutils}/bin/tty) - while read -r line <&3; do - case $line in - 'OPTION ttyname='*) - echo "OPTION ttyname=$TTY" - ;; - *) - echo "$line" - esac - done | ${pkgs.pinentry.tty}/bin/pinentry-tty "$@" >&4 - ''} \ - "$@" - ''; - } diff --git a/tv/5pkgs/simple/q/default.nix b/tv/5pkgs/simple/q/default.nix deleted file mode 100644 index e17282e1..00000000 --- a/tv/5pkgs/simple/q/default.nix +++ /dev/null @@ -1,196 +0,0 @@ -{ pkgs, ... }: -with import <stockholm/lib>; -let - q-cal = let - - # Maximum width of cal's output. - calwidth = 23; - - # Number of space characters between two calendars. - hspace = 2; - - # Return number of columns required to print n calenders side by side. - need_width = n: - assert n >= 1; - n * calwidth + (n - 1) * hspace; - - pad = /* sh */ ''{ - ${pkgs.gnused}/bin/sed ' - # rtrim - s/ *$// - - # delete last empty line - ''${/^$/d} - ' \ - | ${pkgs.gawk}/bin/awk '{printf "%-${toString calwidth}s\n", $0}' \ - | ${pkgs.gnused}/bin/sed ' - # colorize header - 1,2s/.*/[38;5;238;1m&[39;22m/ - - # colorize week number - s/^[ 1-9][0-9]/[38;5;238;1m&[39;22m/ - ' - }''; - in /* sh */ '' - cols=$(${pkgs.ncurses}/bin/tput cols) - ${pkgs.coreutils}/bin/paste \ - <(if test $cols -ge ${toString (need_width 3)}; then - ${pkgs.utillinux}/bin/cal -mw \ - $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \ - | ${pad} - fi) \ - <(if test $cols -ge ${toString (need_width 1)}; then - ${pkgs.utillinux}/bin/cal -mw \ - | ${pkgs.gnused}/bin/sed ' - # colorize day of month - s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/[31;1m&[39;22m/ - ' \ - | ${pad} - fi) \ - <(if test $cols -ge ${toString (need_width 2)}; then - ${pkgs.utillinux}/bin/cal -mw \ - $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \ - | ${pad} - fi) \ - | ${pkgs.gnused}/bin/sed ' - s/^\t// - s/\t$// - s/\t/${lpad hspace " " ""}/g - ' - ''; - - q-isodate = /* sh */ '' - ${pkgs.coreutils}/bin/date \ - '+[1m%Y-%m-%d[;30mT[;38;5;085m%H:%M[m:%S%:z' - ''; - - # Singapore's red is #ED2E38 - q-sgtdate = /* sh */ '' - TZ=Asia/Singapore \ - ${pkgs.coreutils}/bin/date \ - '+[1m%Y-%m-%d[;30mT[;38;5;088m%H:%M[m:%S%:z' - ''; - - q-utcdate = /* sh */ '' - ${pkgs.coreutils}/bin/date -u \ - '+[1m%Y-%m-%d[;30mT[;38;5;065m%H:%M[m:%S%:z' - ''; - - q-gitdir = /* sh */ '' - if test -d .git; then - #git status --porcelain - branch=$( - ${pkgs.git}/bin/git branch \ - | ${pkgs.gnused}/bin/sed -rn 's/^\* (.*)/\1/p' - ) - echo "± $LOGNAME@''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)}:$PWD .git $branch" - fi - ''; - - q-intel_backlight = /* sh */ '' - cd /sys/class/backlight/intel_backlight - </dev/null exec ${pkgs.gawk}/bin/awk ' - END { - getline actual_brightness < "actual_brightness" - getline max_brightness < "max_brightness" - getline brightness < "brightness" - printf "intel_backlight %d%% %d/%d\n" \ - , actual_brightness / max_brightness * 100 \ - , actual_brightness \ - , max_brightness - } - ' - ''; - - q-virtualization = /* sh */ '' - echo "VT: $(${pkgs.systemd}/bin/systemd-detect-virt)" - ''; - - q-wireless = /* sh */ '' - for dev in $( - ${pkgs.iw}/bin/iw dev \ - | ${pkgs.gnused}/bin/sed -n 's/^\s*Interface\s\+\([0-9a-z]\+\)$/\1/p' - ); do - inet=$(${pkgs.iproute}/bin/ip addr show $dev \ - | ${pkgs.gnused}/bin/sed -n ' - s/.*inet \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p - ') \ - || unset inet - ssid=$(${pkgs.iw}/bin/iw dev $dev link \ - | ${pkgs.gnused}/bin/sed -n ' - s/.*\tSSID: \(.*\)/\1/p - ') \ - || unset ssid - echo "$dev''${inet+ $inet}''${ssid+ $ssid}" - done - ''; - - q-online = /* sh */ '' - if ${pkgs.curl}/bin/curl -s google.com >/dev/null; then - echo '[32;1monline[m' - else - echo offline - fi - ''; - - q-thermal_zone = /* sh */ '' - for i in /sys/class/thermal/thermal_zone*; do - type=$(${pkgs.coreutils}/bin/cat $i/type) - temp=$(${pkgs.coreutils}/bin/cat $i/temp) - printf '%s %s°C\n' $type $(echo $temp / 1000 | ${pkgs.bc}/bin/bc) - done - ''; - - q-todo = /* sh */ '' - TODO_file=$PWD/TODO - if test -e "$TODO_file"; then - ${pkgs.jq}/bin/jq -Rrs <"$TODO_file" -f ${pkgs.writeJq "q-todo.jq" '' - split("\n") | map( - (match("^([0-9]+-\\d{2}-\\d{2})\\s+(.*)$").captures | map(.string)) - as $captures | - ($captures[0] | strptime("%Y-%m-%d") | mktime) as $date | - $captures[1] as $text | - - select(now >= $date) | - - ($text | test("\\[URGENT]"; "i")) as $urgent | - (if $urgent then "38;5;196" else "38;5;208" end) as $sgr | - if $urgent then sub("\\s*\\[URGENT]\\s*"; " "; "i") else . end | |