Files
nixos-config/modules/user/yazi.nix
T

135 lines
2.8 KiB
Nix
Raw Normal View History

2025-09-01 18:18:53 +03:00
{ pkgs, lib, inputs, ... }: {
home.packages = with pkgs; [
( ouch.override { enableUnfree = true; } )
];
2026-03-12 04:09:08 +03:00
wayland.windowManager.hyprland.settings.windowrule = [
"match:class dragon-drop, move cursor_x-window_w/2 cursor_y-window_h/2"
];
2024-09-27 23:08:25 +03:00
programs.yazi = {
2025-09-01 18:18:53 +03:00
package = inputs.yazi.packages
.${pkgs.stdenv.hostPlatform.system}.default
.override { _7zz = pkgs._7zz-rar; };
2024-09-27 23:08:25 +03:00
enable = true;
enableZshIntegration = true;
shellWrapperName = "y";
settings = {
2025-06-08 02:46:53 +03:00
mgr = {
2024-09-27 23:08:25 +03:00
show_hidden = true;
};
preview = {
max_width = 1000;
max_height = 1000;
};
2025-06-26 19:50:54 +03:00
plugin = {
preloaders = [
2026-04-29 00:16:31 +03:00
{ url = "*.crdownload"; run = "noop"; }
2025-06-26 19:50:54 +03:00
];
2025-09-01 18:18:53 +03:00
prepend_previewers = [
{ mime = "application/xz"; run = "ouch"; }
{ mime = "application/zip"; run = "ouch"; }
{ mime = "application/rar"; run = "ouch"; }
{ mime = "application/gzip"; run = "ouch"; }
{ mime = "application/7z-compressed"; run = "ouch"; }
];
prepend_fetchers = [
2026-04-29 00:16:31 +03:00
{ group = "git"; url = "*"; run = "git"; }
2025-09-01 18:18:53 +03:00
];
2025-06-26 19:50:54 +03:00
};
2024-09-27 23:08:25 +03:00
};
2026-04-29 00:16:31 +03:00
plugins = let
yaziPlugin = name: pkgs.stdenvNoCC.mkDerivation {
pname = "${name}.yazi";
version = "unstable";
src = inputs.yazi-plugins;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r ${name}.yazi/* $out/
rm -f $out/LICENSE
cp LICENSE $out/LICENSE
runHook postInstall
'';
};
in with pkgs.yaziPlugins; {
2025-09-01 18:18:53 +03:00
inherit
chmod
ouch
mount
toggle-pane
2026-04-29 00:16:31 +03:00
;
full-border = {
package = yaziPlugin "full-border";
setup = true;
};
starship = {
package = starship;
setup = true;
};
git = {
package = git;
setup = true;
};
2024-09-27 23:08:25 +03:00
};
initLua = ''
2025-12-14 18:28:47 +03:00
Status:children_add(function()
local h = cx.active.current.hovered
if not h or ya.target_family() ~= "unix" then
return ""
end
return ui.Line {
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
":",
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
" ",
}
end, 500, Status.RIGHT)
2024-09-27 23:08:25 +03:00
'';
keymap = {
2025-06-08 02:46:53 +03:00
mgr.prepend_keymap = [
2024-09-27 23:08:25 +03:00
{
on = "T";
2025-09-01 18:18:53 +03:00
run = "plugin toggle-pane max-preview";
2024-09-27 23:08:25 +03:00
desc = "Maximize or restore the preview pane";
}
2025-12-14 18:28:47 +03:00
{
on = "Y";
2026-04-29 00:16:31 +03:00
run = ''shell -- for path in %s; do echo "file://$path"; done | wl-copy -t text/uri-list'';
2025-12-14 18:28:47 +03:00
desc = "Copy files into system clipboard";
}
2024-09-27 23:08:25 +03:00
{
on = ["c" "m"];
run = "plugin chmod";
desc = "Chmod on selected files";
}
2025-09-01 18:18:53 +03:00
{
on = ["M"];
run = "plugin mount";
desc = "Open mount menu";
}
2024-12-17 22:27:15 +03:00
{
on = [ "<C-n>" ];
2025-12-14 18:28:47 +03:00
run = "shell '${lib.getExe pkgs.dragon-drop} -x -A -i -T %s'";
2024-12-17 22:27:15 +03:00
}
2025-03-29 15:04:24 +03:00
{
on = [ "g" "<S-d>" ];
run = ''cd /mnt/D'';
desc = "Goto D drive";
}
2024-09-27 23:08:25 +03:00
];
};
};
}