nix-config/home/lf/default.nix

32 lines
826 B
Nix
Raw Normal View History

2022-03-14 15:20:17 +01:00
{ config, pkgs, ... }:
let
pv = pkgs.callPackage ./pv.nix { inherit config pkgs; };
lf-wrapper = pkgs.callPackage ./lf-wrapper.nix { inherit config pkgs; };
cleaner = pkgs.callPackage ./cleaner.nix { inherit config pkgs; };
in {
home.packages = [ lf-wrapper ];
programs.lf = {
enable = true;
previewer.source = pv;
settings.icons = true;
2022-03-15 08:21:12 +01:00
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
}}
'';
};
2022-03-14 15:20:17 +01:00
extraConfig = ''
set cleaner ${cleaner}
'';
};
}