nix-config/modules/home-manager/lf/default.nix

29 lines
699 B
Nix

{ config, pkgs, ... }:
let
pv = pkgs.callPackage ./pv.nix { inherit config pkgs; };
lf-wrapper = pkgs.callPackage ./lf-wrapper.nix { inherit config pkgs; };
in
{
home.packages = [ lf-wrapper ];
programs.lf = {
enable = true;
previewer.source = pv;
settings.icons = true;
commands = {
get-mime-type = ''%xdg-mime query filetype "$f"'';
open = ''
''${{
test -L $f && f=$(readlink -f $f)
case $(file --mime-type $f -b) in
text/*) vi $fx;;
application/json) vi $fx;;
*) for f in $fx; do xdg-open $f > /dev/null 2> /dev/null & done;;
esac
}}
'';
};
};
}