diff options
author | tv <tv@krebsco.de> | 2020-04-17 19:21:16 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-04-17 19:21:16 +0200 |
commit | e1bfdd8d839929538d36e421908a96407b3aa0ab (patch) | |
tree | 557bf9a711f06997e846a5ef14a4105248f1da8c /lass | |
parent | 6ace0f7b6941c1c9476d84944cdba8bedf98d95d (diff) | |
parent | 07f18d851a974ee594c92e3332f167ef3b1d259f (diff) |
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'lass')
-rw-r--r-- | lass/1systems/hilum/config.nix | 2 | ||||
-rw-r--r-- | lass/1systems/mors/config.nix | 8 | ||||
-rw-r--r-- | lass/1systems/prism/config.nix | 54 | ||||
-rw-r--r-- | lass/1systems/xerxes/config.nix | 4 | ||||
-rw-r--r-- | lass/1systems/yellow/config.nix | 101 | ||||
-rw-r--r-- | lass/2configs/exim-smarthost.nix | 8 | ||||
-rw-r--r-- | lass/2configs/games.nix | 2 | ||||
-rw-r--r-- | lass/2configs/green-host.nix | 2 | ||||
-rw-r--r-- | lass/2configs/mpv.nix | 76 | ||||
-rw-r--r-- | lass/2configs/radio.nix | 58 | ||||
-rw-r--r-- | lass/2configs/sync/decsync.nix | 4 | ||||
-rw-r--r-- | lass/2configs/sync/weechat.nix | 2 | ||||
-rw-r--r-- | lass/2configs/syncthing.nix | 16 | ||||
-rw-r--r-- | lass/2configs/websites/domsen.nix | 6 | ||||
-rw-r--r-- | lass/5pkgs/bruellwuerfel/default.nix | 26 | ||||
-rw-r--r-- | lass/5pkgs/fzfmenu/default.nix | 26 |
16 files changed, 330 insertions, 65 deletions
diff --git a/lass/1systems/hilum/config.nix b/lass/1systems/hilum/config.nix index 7a506591b..3f25991d9 100644 --- a/lass/1systems/hilum/config.nix +++ b/lass/1systems/hilum/config.nix @@ -33,4 +33,6 @@ services.logind.lidSwitch = "ignore"; services.logind.lidSwitchDocked = "ignore"; + + boot.tmpOnTmpfs = true; } diff --git a/lass/1systems/mors/config.nix b/lass/1systems/mors/config.nix index 03ff42132..fe0b6d85b 100644 --- a/lass/1systems/mors/config.nix +++ b/lass/1systems/mors/config.nix @@ -49,17 +49,17 @@ with import <stockholm/lib>; ]; } { - krebs.syncthing = { - peers.schasch.addresses = [ "schasch.r:22000" ]; + services.syncthing.declarative = { + devices.schasch.addresses = [ "schasch.r:22000" ]; folders = { the_playlist = { path = "/home/lass/tmp/the_playlist"; - peers = [ "mors" "phone" "prism" "xerxes" ]; + devices = [ "mors" "phone" "prism" "xerxes" ]; }; free_music = { id = "mu9mn-zgvsw"; path = "/home/lass/tmp/free_music"; - peers = [ "mors" "schasch" ]; + devices = [ "mors" "schasch" ]; }; }; }; diff --git a/lass/1systems/prism/config.nix b/lass/1systems/prism/config.nix index cde65ea6c..c6e0400bf 100644 --- a/lass/1systems/prism/config.nix +++ b/lass/1systems/prism/config.nix @@ -338,30 +338,36 @@ with import <stockholm/lib>; localAddress = "10.233.2.14"; }; - services.nginx.virtualHosts."lassul.us".locations."^~ /flix/".extraConfig = '' - if ($scheme != "https") { - rewrite ^ https://$host$request_uri permanent; - } - auth_basic "Restricted Content"; - auth_basic_user_file ${pkgs.writeText "flix-user-pass" '' - krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0 - ''}; - proxy_pass http://10.233.2.14:80/; - proxy_set_header Accept-Encoding ""; - sub_filter "https://lassul.us/" "https://lassul.us/flix/"; - sub_filter_once off; - ''; - services.nginx.virtualHosts."lassul.us".locations."^~ /transmission".extraConfig = '' - if ($scheme != "https") { - rewrite ^ https://$host$request_uri permanent; - } - auth_basic "Restricted Content"; - auth_basic_user_file ${pkgs.writeText "transmission-user-pass" '' - krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0 - ''}; - proxy_pass_header X-Transmission-Session-Id; - proxy_pass http://10.233.2.14:9091; - ''; + services.nginx.virtualHosts."lassul.us" = { + locations."^~ /flix/".extraConfig = '' + if ($scheme != "https") { + rewrite ^ https://$host$request_uri permanent; + } + auth_basic "Restricted Content"; + auth_basic_user_file ${pkgs.writeText "flix-user-pass" '' + krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0 + ''}; + proxy_pass http://10.233.2.14:80/; + proxy_set_header Accept-Encoding ""; + sub_filter "https://lassul.us/" "https://lassul.us/flix/"; + sub_filter_once off; + ''; + locations."^~ /chatty/".extraConfig = '' + rewrite ^ https://$host/flix/$request_uri permanent; + ''; + #locations."^~ /transmission".return = "301 https://$host/transmission/web/"; + locations."^~ /transmission/".extraConfig = '' + if ($scheme != "https") { + rewrite ^ https://$host$request_uri permanent; + } + auth_basic "Restricted Content"; + auth_basic_user_file ${pkgs.writeText "transmission-user-pass" '' + krebs:$apr1$1Fwt/4T0$YwcUn3OBmtmsGiEPlYWyq0 + ''}; + proxy_pass_header X-Transmission-Session-Id; + proxy_pass http://10.233.2.14:9091; + ''; + }; users.groups.download = {}; users.users = { diff --git a/lass/1systems/xerxes/config.nix b/lass/1systems/xerxes/config.nix index 8630d0f4b..e4a4fb505 100644 --- a/lass/1systems/xerxes/config.nix +++ b/lass/1systems/xerxes/config.nix @@ -41,11 +41,11 @@ displayManager.lightdm.autoLogin.user = "lass"; }; - krebs.syncthing = { + services.syncthing.declarative = { folders = { the_playlist = { path = "/home/lass/tmp/the_playlist"; - peers = [ "mors" "phone" "prism" "xerxes" ]; + devices = [ "mors" "phone" "prism" "xerxes" ]; }; }; }; diff --git a/lass/1systems/yellow/config.nix b/lass/1systems/yellow/config.nix index abbc0045b..82fe3fac5 100644 --- a/lass/1systems/yellow/config.nix +++ b/lass/1systems/yellow/config.nix @@ -54,12 +54,107 @@ with import <stockholm/lib>; root = "/var/download/finished"; extraConfig = '' fancyindex on; - dav_methods PUT DELETE MKCOL COPY MOVE; - + fancyindex_footer "/fancy.html"; + include ${pkgs.nginx}/conf/mime.types; + include ${pkgs.writeText "extrMime" '' + types { + video/webm mkv; + } + ''}; create_full_put_path on; - dav_access all:r; ''; }; + locations."/chatty" = { + proxyPass = "http://localhost:3000"; + extraConfig = '' + rewrite /chatty/(.*) /$1 break; + proxy_set_header Host $host; + ''; + }; + locations."= /fancy.html".extraConfig = '' + alias ${pkgs.writeText "nginx_footer" '' + <div id="mydiv"> + <!-- Include a header DIV with the same name as the draggable DIV, followed by "header" --> + <div id="mydivheader">Click here to move</div> + <iframe src="/chatty/index.html"></iframe> + </div> + <style> + #mydiv { + position: absolute; + z-index: 9; + background-color: #f1f1f1; + border: 1px solid #d3d3d3; + text-align: center; + } + + #mydivheader { + padding: 10px; + cursor: move; + z-index: 10; + background-color: #2196F3; + color: #fff; + } + </style> + <script> + // Make the DIV element draggable: + dragElement(document.getElementById("mydiv")); + + function dragElement(elmnt) { + var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; + if (document.getElementById(elmnt.id + "header")) { + // if present, the header is where you move the DIV from: + document.getElementById(elmnt.id + "header").onmousedown = dragMouseDown; + } else { + // otherwise, move the DIV from anywhere inside the DIV: + elmnt.onmousedown = dragMouseDown; + } + + function dragMouseDown(e) { + e = e || window.event; + e.preventDefault(); + // get the mouse cursor position at startup: + pos3 = e.clientX; + pos4 = e.clientY; + document.onmouseup = closeDragElement; + // call a function whenever the cursor moves: + document.onmousemove = elementDrag; + } + + function elementDrag(e) { + e = e || window.event; + e.preventDefault(); + // calculate the new cursor position: + pos1 = pos3 - e.clientX; + pos2 = pos4 - e.clientY; + pos3 = e.clientX; + pos4 = e.clientY; + // set the element's new position: + elmnt.style.top = (elmnt.offsetTop - pos2) + "px"; + elmnt.style.left = (elmnt.offsetLeft - pos1) + "px"; + } + + function closeDragElement() { + // stop moving when mouse button is released: + document.onmouseup = null; + document.onmousemove = null; + } + } + </script> + ''}; + ''; + }; + }; + + systemd.services.bruellwuerfel = { + wantedBy = [ "multi-user.target" ]; + environment = { + IRC_CHANNEL = "#flix"; + IRC_NICK = "bruelli"; + IRC_SERVER = "irc.r"; + IRC_HISTORY_FILE = "/tmp/bruelli.history"; + }; + serviceConfig = { + ExecStart = "${pkgs.bruellwuerfel}/bin/bruellwuerfel"; }; }; diff --git a/lass/2configs/exim-smarthost.nix b/lass/2configs/exim-smarthost.nix index 565608633..08a226e6d 100644 --- a/lass/2configs/exim-smarthost.nix +++ b/lass/2configs/exim-smarthost.nix @@ -102,6 +102,14 @@ "microsoft@lassul.us" "stickers@lassul.us" "nextbike@lassul.us" + "mytello@lassul.us" + "camp@lassul.us" + "urlwatch@lassul.us" + "lidl@lassul.us" + "geizhals@lassul.us" + "auschein@lassul.us" + "tleech@lassul.us" + "durstexpress@lassul.us" ]; in { diff --git a/lass/2configs/games.nix b/lass/2configs/games.nix index c0e6beba4..63bfa53e0 100644 --- a/lass/2configs/games.nix +++ b/lass/2configs/games.nix @@ -65,7 +65,7 @@ in { createHome = true; useDefaultShell = true; packages = with pkgs; [ - minecraft + # minecraft steam-run scummvm dolphinEmu diff --git a/lass/2configs/green-host.nix b/lass/2configs/green-host.nix index 1421eede7..0cccbc30e 100644 --- a/lass/2configs/green-host.nix +++ b/lass/2configs/green-host.nix @@ -20,7 +20,7 @@ with import <stockholm/lib>; } ]; - krebs.syncthing.folders."/var/lib/sync-containers".peers = [ "icarus" "skynet" "littleT" "shodan" ]; + services.syncthing.declarative.folders."/var/lib/sync-containers".devices = [ "icarus" "skynet" "littleT" "shodan" ]; krebs.permown."/var/lib/sync-containers" = { owner = "root"; group = "syncthing"; diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix index b3de42c7b..5d7bfed60 100644 --- a/lass/2configs/mpv.nix +++ b/lass/2configs/mpv.nix @@ -2,11 +2,85 @@ let + download_subs = pkgs.writers.writePython3 "download_sub" { + libraries = [ pkgs.python3Packages.subliminal ]; + } '' + from subliminal import download_best_subtitles, scan_video + from babelfish import Language + import sys + + video_filename = sys.argv[1] + + vid = scan_video(video_filename) + try: + sub = download_best_subtitles([vid], {Language('eng')})[vid][0] + + filename = '/tmp/' + vid.title + '.srt' + + with open(filename, 'wb+') as file: + file.write(sub.content) + + print(filename) + except: # noqa + print("/dev/null") + ''; + + autosub = pkgs.writeText "autosub.lua" '' + -- Requires Subliminal version 1.0 or newer + -- Make sure to specify your system's Subliminal location below: + local utils = require 'mp.utils' + + -- Log function: log to both terminal and mpv OSD (On-Screen Display) + function log(string, secs) + secs = secs or 2 -- secs defaults to 2 when the secs parameter is absent + mp.msg.warn(string) -- This logs to the terminal + mp.osd_message(string, secs) -- This logs to mpv screen + end + + function download() + log('Searching subtitles ...', 10) + table = { args = {"${download_subs}", mp.get_property('path')} } + result = utils.subprocess(table) + if result.error == nil then + -- remove trailing newline from subtitle filename + filename = string.gsub(result.stdout, "\n", "") + log(filename) + mp.commandv('sub_add', filename) + log('Subtitles ready!') + else + log('Subtitles failed downloading') + end + end + + -- Control function: only download if necessary + function control_download() + duration = tonumber(mp.get_property('duration')) + if duration < 900 then + mp.msg.warn('Video is less than 15 minutes\n', '=> NOT downloading any subtitles') + return + end + -- There does not seem to be any documentation for the 'sub' property, + -- but it works on both internally encoded as well as external subtitle files! + -- -> sub = '1' when subtitles are present + -- -> sub = 'no' when subtitles are not present + -- -> sub = 'auto' when called before the 'file-loaded' event is triggered + sub = mp.get_property('sub') + if sub == '1' then + mp.msg.warn('Sub track is already present\n', '=> NOT downloading other subtitles') + return + end + mp.msg.warn('No sub track was detected\n', '=> Proceeding to download subtitles:') + download() + end + + mp.add_key_binding('S', "download_subs", download) + ''; + mpv = pkgs.symlinkJoin { name = "mpv"; paths = [ (pkgs.writeDashBin "mpv" '' - exec ${pkgs.mpv}/bin/mpv --no-config "$@" + exec ${pkgs.mpv}/bin/mpv --no-config --script=${autosub} "$@" '') pkgs.mpv ]; diff --git a/lass/2configs/radio.nix b/lass/2configs/radio.nix index b24d7af3e..c4c4b0abb 100644 --- a/lass/2configs/radio.nix +++ b/lass/2configs/radio.nix @@ -9,16 +9,46 @@ let admin-password = import <secrets/icecast-admin-pw>; source-password = import <secrets/icecast-source-pw>; + music_dir = "/home/radio/music"; + add_random = pkgs.writeDashBin "add_random" '' - ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.mpc_cli}/bin/mpc ls the_playlist/music | grep '\.ogg$' | shuf -n1)" + ${pkgs.mpc_cli}/bin/mpc add "$(${pkgs.findutils}/bin/find "${music_dir}/the_playlist" | grep '\.ogg$' | shuf -n1 | sed 's,${music_dir}/,,')" ''; - skip_track = pkgs.writeDashBin "skip_track" '' + skip_track = pkgs.writeBashBin "skip_track" '' + set -eu + ${add_random}/bin/add_random - echo skipping: "$(${print_current}/bin/print_current)" + music_dir=${escapeShellArg music_dir} + current_track=$(${pkgs.mpc_cli}/bin/mpc current -f %file%) + track_infos=$(${print_current}/bin/print_current) + skip_count=$(${pkgs.attr}/bin/getfattr -n user.skip_count --only-values "$music_dir"/"$current_track" || echo 0) + if [[ "$current_track" =~ ^the_playlist/music/.* ]] && [ "$skip_count" -le 2 ]; then + skip_count=$((skip_count+1)) + ${pkgs.attr}/bin/setfattr -n user.skip_count -v "$skip_count" "$music_dir"/"$current_track" + echo skipping: "$track_infos" skip_count: "$skip_count" + else + mkdir -p "$music_dir"/.graveyard/ + mv "$music_dir"/"$current_track" "$music_dir"/.graveyard/ + echo killing: "$track_infos" + fi ${pkgs.mpc_cli}/bin/mpc -q next ''; + good_track = pkgs.writeBashBin "good_track" '' + set -eu + + music_dir=${escapeShellArg music_dir} + current_track=$(${pkgs.mpc_cli}/bin/mpc current -f %file%) + track_infos=$(${print_current}/bin/print_current) + if [[ "$current_track" =~ ^the_playlist/music/.* ]]; then + ${pkgs.attr}/bin/setfattr -n user.skip_count -v 0 "$music_dir"/"$current_track" + else + mv "$music_dir"/"$current_track" "$music_dir"/the_playlist/music/ + fi + echo good: "$track_infos" + ''; + print_current = pkgs.writeDashBin "print_current" '' echo "$(${pkgs.mpc_cli}/bin/mpc current -f %file%) \ $(${pkgs.mpc_cli}/bin/mpc current -f %file% \ @@ -48,6 +78,7 @@ in { krebs.per-user.${name}.packages = with pkgs; [ add_random + good_track skip_track print_current ncmpcpp @@ -57,7 +88,7 @@ in { services.mpd = { enable = true; group = "radio"; - musicDirectory = "/home/radio/music"; + musicDirectory = "${music_dir}"; extraConfig = '' log_level "default" auto_update "yes" @@ -178,11 +209,15 @@ in { }; }; + # allow reaktor2 to modify files + systemd.services."reaktor2-the_playlist".serviceConfig.DynamicUser = mkForce false; + krebs.reaktor2.the_playlist = { hostname = "irc.freenode.org"; port = "6697"; useTLS = true; nick = "the_playlist"; + username = "radio"; plugins = [ { plugin = "register"; @@ -199,12 +234,19 @@ in { workdir = config.krebs.reaktor2.the_playlist.stateDir; hooks.PRIVMSG = [ { - #activate = "match"; - pattern = "^\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$"; + activate = "match"; + pattern = "^(?:.*\\s)?\\s*the_playlist:\\s*([0-9A-Za-z._][0-9A-Za-z._-]*)(?:\\s+(.*\\S))?\\s*$"; command = 1; arguments = [2]; commands = { skip.filename = "${skip_track}/bin/skip_track"; + next.filename = "${skip_track}/bin/skip_track"; + bad.filename = "${skip_track}/bin/skip_track"; + + good.filename = "${good_track}/bin/good_track"; + nice.filename = "${good_track}/bin/good_track"; + like.filename = "${good_track}/bin/good_track"; + current.filename = "${print_current}/bin/print_current"; suggest.filename = pkgs.writeDash "suggest" '' echo "$@" >> playlist_suggest @@ -258,9 +300,9 @@ in { alias ${html}; ''; }; - krebs.syncthing.folders."the_playlist" = { + services.syncthing.declarative.folders."the_playlist" = { path = "/home/radio/music/the_playlist"; - peers = [ "mors" "phone" "prism" "xerxes" ]; + devices = [ "mors" "phone" "prism" "xerxes" ]; }; krebs.permown."/home/radio/music/the_playlist" = { owner = "radio"; diff --git a/lass/2configs/sync/decsync.nix b/lass/2configs/sync/decsync.nix index c3f6511c2..9caefdd2d 100644 --- a/lass/2configs/sync/decsync.nix +++ b/lass/2configs/sync/decsync.nix @@ -1,7 +1,7 @@ { - krebs.syncthing.folders.decsync = { + services.syncthing.declarative.folders.decsync = { path = "/home/lass/decsync"; - peers = [ "mors" "blue" "green" "phone" ]; + devices = [ "mors" "blue" "green" "phone" ]; }; krebs.permown."/home/lass/decsync" = { owner = "lass"; diff --git a/lass/2configs/sync/weechat.nix b/lass/2configs/sync/weechat.nix index 30c7b262b..ccbfc75a1 100644 --- a/lass/2configs/sync/weechat.nix +++ b/lass/2configs/sync/weechat.nix @@ -1,5 +1,5 @@ { - krebs.syncthing.folders."/home/lass/.weechat".peers = [ "blue" "green" "mors" ]; + services.syncthing.declarative.folders."/home/lass/.weechat".devices = [ "blue" "green" "mors" ]; krebs.permown."/home/lass/.weechat" = { owner = "lass"; group = "syncthing"; diff --git a/lass/2configs/syncthing.nix b/lass/2configs/syncthing.nix index d4df17b9a..5397c2ca6 100644 --- a/lass/2configs/syncthing.nix +++ b/lass/2configs/syncthing.nix @@ -7,18 +7,20 @@ in { enable = true; group = "syncthing"; configDir = "/var/lib/syncthing"; + declarative = { + key = toString <secrets/syncthing.key>; + cert = toString <secrets/syncthing.cert>; + devices = mk_peers all_peers; + folders."/home/lass/sync" = { + devices = attrNames (filterAttrs (n: v: n != "phone") own_peers); + # ignorePerms = false; + }; + }; }; krebs.iptables.tables.filter.INPUT.rules = [ { predicate = "-p tcp --dport 22000"; target = "ACCEPT";} { predicate = "-p udp --dport 21027"; target = "ACCEPT";} ]; - krebs.syncthing = { - enable = true; - cert = toString <secrets/syncthing.cert>; - key = toString <secrets/syncthing.key>; - peers = mk_peers all_peers; - folders."/home/lass/sync".peers = attrNames (filterAttrs (n: v: n != "phone") own_peers); - }; system.activationScripts.syncthing-home = '' ${pkgs.coreutils}/bin/chmod a+x /home/lass diff --git a/lass/2configs/websites/domsen.nix b/lass/2configs/websites/domsen.nix index 80ed12edc..bd113567f 100644 --- a/lass/2configs/websites/domsen.nix +++ b/lass/2configs/websites/domsen.nix @@ -270,14 +270,14 @@ in { }; boot.kernel.sysctl."fs.inotify.max_user_watches" = "1048576"; - krebs.syncthing.folders = { + services.syncthing.declarative.folders = { domsen-backups = { path = "/backups/domsen"; - peers = [ "domsen-backup" ]; + devices = [ "domsen-backup" ]; }; domsen-backup-srv-http = { path = "/srv/http"; - peers = [ "domsen-backup" ]; + devices = [ "domsen-backup" ]; }; }; diff --git a/lass/5pkgs/bruellwuerfel/default.nix b/lass/5pkgs/bruellwuerfel/default.nix new file mode 100644 index 000000000..cb8f08fa8 --- /dev/null +++ b/lass/5pkgs/bruellwuerfel/default.nix @@ -0,0 +1,26 @@ +{ yarn2nix-moretea, fetchFromGitHub, nodePackages, nodejs }: let + #src = ~/src/bruellwuerfel; + src = fetchFromGitHub { + owner = "krebs"; + repo = "bruellwuerfel"; + rev = "57e20e630f732ce4e15b495ec5f9bf72a121b959"; + sha256 = "08zwwl24sq21r497a03lqpy2x10az8frrsh6d38xm92snd1yf85b"; + }; + +in yarn2nix-moretea.mkYarnModules rec { + pname = "bruellwuerfel"; + version = "1.0"; + name = "${pname}-${version}"; + packageJSON = "${src}/package.json"; + yarnLock = "${src}/yarn.lock"; + postBuild = '' + cp -r ${src}/{src,tsconfig.json} $out/ + cd $out + ${nodePackages.typescript}/bin/tsc || : + mkdir -p $out/bin + echo '#!/bin/sh' > $out/bin/bruellwuerfel + echo "export NODE_PATH=$out/dist" >> $out/bin/bruellwuerfel + echo "${nodejs}/bin/node $out/dist/index.js" >> $out/bin/bruellwuerfel + chmod +x $out/bin/bruellwuerfel + ''; +} diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix index bdae8ceed..64e95d233 100644 --- a/lass/5pkgs/fzfmenu/default.nix +++ b/lass/5pkgs/fzfmenu/default.nix @@ -32,14 +32,24 @@ pkgs.writeDashBin "fzfmenu" '' done INPUT=$(${pkgs.coreutils}/bin/cat) OUTPUT="$(${pkgs.coreutils}/bin/mktemp)" - ${pkgs.rxvt_unicode}/bin/urxvt \ - -name fzfmenu -title fzfmenu \ - -e ${pkgs.dash}/bin/dash -c \ - "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ - --history=/dev/null \ - --print-query \ - --prompt=\"$PROMPT\" \ - > \"$OUTPUT\"" 2>/dev/null + if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell + ${pkgs.rxvt_unicode}/bin/urxvt \ + -name fzfmenu -title fzfmenu \ + -e ${pkgs.dash}/bin/dash -c \ + "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ + --history=/dev/null \ + --print-query \ + --prompt=\"$PROMPT\" \ + --reverse \ + > \"$OUTPUT\"" 2>/dev/null + else + echo "$INPUT" | ${pkgs.fzf}/bin/fzf \ + --history=/dev/null \ + --print-query \ + --prompt="$PROMPT" \ + --reverse \ + > "$OUTPUT" + fi ${pkgs.coreutils}/bin/tail -1 "$OUTPUT" ${pkgs.coreutils}/bin/rm "$OUTPUT" '' |