From ac9d61188407fb6d133a0f0a8912a04f4d860677 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 16 Jun 2020 20:27:59 +0200 Subject: fzfmenu: make -name and -title configurable --- krebs/5pkgs/simple/fzfmenu/default.nix | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix index 64e95d23..1ee55a5a 100644 --- a/krebs/5pkgs/simple/fzfmenu/default.nix +++ b/krebs/5pkgs/simple/fzfmenu/default.nix @@ -1,4 +1,31 @@ -{ pkgs, ... }: +with import ; +{ pkgs, ... }@args: + +let + # 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 = evalModules { + modules = singleton { + _file = toString ./profile.nix; + imports = singleton config; + options = { + appName = mkOption { + default = "fzfmenu"; + type = types.label; + }; + windowTitle = mkOption { + default = "fzfmenu"; + type = types.str; + }; + }; + }; + }; +in pkgs.writeDashBin "fzfmenu" '' set -efu @@ -34,7 +61,8 @@ pkgs.writeDashBin "fzfmenu" '' OUTPUT="$(${pkgs.coreutils}/bin/mktemp)" if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell ${pkgs.rxvt_unicode}/bin/urxvt \ - -name fzfmenu -title fzfmenu \ + -name ${cfg.appName} \ + -title ${shell.escape cfg.windowTitle} \ -e ${pkgs.dash}/bin/dash -c \ "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ --history=/dev/null \ -- cgit v1.2.3