diff options
author | tv <tv@krebsco.de> | 2020-06-16 20:27:59 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2020-06-16 20:27:59 +0200 |
commit | ac9d61188407fb6d133a0f0a8912a04f4d860677 (patch) | |
tree | d85767770104b70397db2cbbdddcf9543673b275 /krebs/5pkgs/simple/fzfmenu/default.nix | |
parent | 15d1fb2627088149d1f46fc5946e1fc53b8f8d54 (diff) |
fzfmenu: make -name and -title configurable
Diffstat (limited to 'krebs/5pkgs/simple/fzfmenu/default.nix')
-rw-r--r-- | krebs/5pkgs/simple/fzfmenu/default.nix | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix index 64e95d233..1ee55a5ab 100644 --- a/krebs/5pkgs/simple/fzfmenu/default.nix +++ b/krebs/5pkgs/simple/fzfmenu/default.nix @@ -1,4 +1,31 @@ -{ pkgs, ... }: +with import <stockholm/lib>; +{ 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 \ |