feat(devkit): yazi wrapper

This commit is contained in:
Guz
2025-02-12 11:22:48 -03:00
parent 179af779f4
commit f9c3d34511
6 changed files with 78 additions and 0 deletions

View File

@@ -3,4 +3,5 @@
git = pkgs.callPackage ./git {}; git = pkgs.callPackage ./git {};
lazygit = pkgs.callPackage ./lazygit {}; lazygit = pkgs.callPackage ./lazygit {};
starship = pkgs.callPackage ./starship {}; starship = pkgs.callPackage ./starship {};
yazi = pkgs.callPackage ./yazi {};
} }

View File

@@ -0,0 +1,43 @@
{
symlinkJoin,
makeWrapper,
pkgs,
lib,
yazi ? pkgs.yazi,
paths ? [],
}: let
drv = symlinkJoin ({
paths = yazi;
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/yazi ${
if (builtins.length paths) > 0
then "$PATH:${lib.makeBinPath paths}"
else ""
} --set-default YAZI_CONFIG_HOME ${./.}
'';
}
// {inherit (yazi) name pname meta;});
in
pkgs.stdenv.mkDerivation (rec {
name = drv.name;
pname = drv.pname;
buildCommand = let
desktopEntry = pkgs.makeDesktopItem {
name = pname;
desktopName = name;
exec = "${lib.getExe drv}";
terminal = true;
};
in ''
mkdir -p $out/bin
cp ${lib.getExe drv} $out/bin
mkdir -p $out/share/applications
cp ${desktopEntry}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
'';
}
// {inherit (yazi) meta;})

View File

@@ -0,0 +1,24 @@
-- Add username and hostname in header
-- https://yazi-rs.github.io/docs/tips#username-hostname-in-header
Header:children_add(function()
if ya.target_family() ~= "unix" then
return ""
end
return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
end, 500, Header.LEFT)
-- Add user and group owner of file in status line
-- https://yazi-rs.github.io/docs/tips#user-group-in-status
Status:children_add(function()
local h = cx.active.current.hovered
if h == nil 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.user_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
" ",
})
end, 500, Status.RIGHT)

View File

View File

View File

@@ -0,0 +1,10 @@
[manager]
show_hidden = true
show_symlink = true
sort_by = "natural"
sort_dir_first = true
sort_sensitive = false
sort_translit = true
linemode = "size"