185 lines
2.7 KiB
Nix
185 lines
2.7 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
shell = "${pkgs.dash}/bin/dash";
|
|
lf = "${pkgs.lf}/bin/lf";
|
|
rm = "${pkgs.coreutils-full}/bin/rm";
|
|
mkdir = "${pkgs.coreutils-full}/bin/mkdir";
|
|
mkfifo = "${pkgs.coreutils-full}/bin/mkfifo";
|
|
lfcache = "${config.home.homeDirectory}/.cache/lf";
|
|
in pkgs.writeScriptBin "lf-wrapper" ''
|
|
#!${shell}
|
|
|
|
set -e
|
|
|
|
export LF_ICONS="\
|
|
tw=:\
|
|
st=:\
|
|
ow=:\
|
|
dt=:\
|
|
di=:\
|
|
fi=:\
|
|
ln=:\
|
|
or=:\
|
|
ex=:\
|
|
*.c=:\
|
|
*.cc=:\
|
|
*.clj=:\
|
|
*.coffee=:\
|
|
*.cpp=:\
|
|
*.css=:\
|
|
*.d=:\
|
|
*.dart=:\
|
|
*.erl=:\
|
|
*.exs=:\
|
|
*.fs=:\
|
|
*.go=:\
|
|
*.h=:\
|
|
*.hh=:\
|
|
*.hpp=:\
|
|
*.hs=:\
|
|
*.html=:\
|
|
*.java=:\
|
|
*.jl=:\
|
|
*.js=:\
|
|
*.json=:\
|
|
*.lua=:\
|
|
*.md=:\
|
|
*.php=:\
|
|
*.pl=:\
|
|
*.pro=:\
|
|
*.py=:\
|
|
*.rb=:\
|
|
*.rs=:\
|
|
*.scala=:\
|
|
*.ts=:\
|
|
*.vim=:\
|
|
*.cmd=:\
|
|
*.ps1=:\
|
|
*.sh=:\
|
|
*.bash=:\
|
|
*.zsh=:\
|
|
*.fish=:\
|
|
*.tar=:\
|
|
*.tgz=:\
|
|
*.arc=:\
|
|
*.arj=:\
|
|
*.taz=:\
|
|
*.lha=:\
|
|
*.lz4=:\
|
|
*.lzh=:\
|
|
*.lzma=:\
|
|
*.tlz=:\
|
|
*.txz=:\
|
|
*.tzo=:\
|
|
*.t7z=:\
|
|
*.zip=:\
|
|
*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