291.1. yazi-26.9.1
Asynchronous terminal file manager with image previews
| Version | 26.9.1, release 2 |
| Shelf | files — File managers, disk-usage analysers, duplicate finders and file locators |
| Phase | 44_apps (Applications), 128 of 422 in build order |
| Licence | MIT |
| Homepage | https://yazi-rs.github.io/ |
| Build time | 19.3 SBU |
| Installed size | 34.8 MiB in 11 files |
| Recipe | ports/core/files/yazi/kpkgbuild |
About
yazi is a terminal file manager written in Rust, with asynchronous I/O and previews of the file under the cursor, pictures among them. It is installed for those pictures: in Konsole, which draws sixel and kitty graphics, yazi shows real thumbnails in a window that is otherwise characters. The package installs yazi, its command-line helper ya, and their shell completions.
Why it is in KDOS
The comment above it in script/phases/44_apps/packages.d/files.txt:
Konsole draws sixel and kitty pictures, so yazi draws real thumbnails in a window that is otherwise a character grid — the one place here a picture beats a filename.
Sources
yazi-26.9.1.tar.gz(1.1 MiB)
sha25666857f1b670469daf258edd0bb2ea51d9ad3e2cab4eea9684028c80059fd6862
upstream: https://github.com/sxyazi/yazi/archive/refs/tags/v26.9.1.tar.gz
archive copy: sources-2/files--yazi-26.9.1.tar.gzyazi-vendor-26.9.1.tar.xz(45.3 MiB)
sha256548e8f3b74e5a65f3d258b22b86d5c4044e9e4c207b73d5c825b95918e21a3a1
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/files--yazi-vendor-26.9.1.tar.xz
Dependencies
Depends on: rust, pkgconf, file, ffmpeg, poppler, resvg, imagemagick, jq, fd, ripgrep, fzf, zoxide, chafa, 7zip, oniguruma.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install yazi'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/files/yazi.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/files/yazi
echo '66857f1b670469daf258edd0bb2ea51d9ad3e2cab4eea9684028c80059fd6862 yazi-26.9.1.tar.gz' | sha256sum -c -
echo '548e8f3b74e5a65f3d258b22b86d5c4044e9e4c207b73d5c825b95918e21a3a1 yazi-vendor-26.9.1.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/yazi
SRC=$SRC_ROOT/yazi-26.9.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf yazi-26.9.1.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export VERGEN_GIT_SHA="$version"
export VERGEN_IDEMPOTENT=1
export YAZI_GEN_COMPLETIONS=1
export RUSTFLAGS="-C target-feature=-crt-static"
cargo build --release --frozen --offline
readelf -d target/release/yazi | grep -q 'NEEDED.*\[libonig\.so\.5\]'
install -Dm755 target/release/yazi $PKG/usr/bin/yazi
install -Dm755 target/release/ya $PKG/usr/bin/ya
for b in yazi-boot/completions/yazi yazi-cli/completions/ya; do
n=${b##*/}
install -Dm644 "$b.bash" "$PKG/usr/share/bash-completion/completions/$n"
install -Dm644 "${b%/*}/_$n" "$PKG/usr/share/zsh/site-functions/_$n"
install -Dm644 "$b.fish" "$PKG/usr/share/fish/vendor_completions.d/$n.fish"
done
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/yazi.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Files (yazi)
GenericName=File Manager
Comment=Browse files with yazi
Exec=yazi %f
Icon=folder
Terminal=true
Categories=System;FileTools;FileManager;
Keywords=file;manager;browser;yazi;preview;
EOF
chmod 644 "$PKG/usr/share/applications/yazi.desktop"
The switches, and why each is set:
VERGEN_GIT_SHA="$version"— yazi’s build script stamps the binary with the commit it came from through vergen, and its version string readsenv!("VERGEN_GIT_SHA"). A release tarball has no.git, and vergen takes the value from this environment variable when it is set, so the release tag stands in for the commit the tarball was cut from.VERGEN_IDEMPOTENT=1— vergen writes the fixed stringVERGEN_IDEMPOTENT_OUTPUTinstead of the build date and other values that change from one build to the next, so two builds of the same source give the same binary.YAZI_GEN_COMPLETIONS=1— Makes the build scripts ofyazi-bootandyazi-cliwrite shell completions foryaziandyainto each crate’scompletions/directory; without it they write none. They write them for bash, zsh, fish, Elvish, PowerShell, Nushell and Fig, andbuild.shinstalls the bash, zsh and fish ones.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/yazi, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf yazi-26.9.1-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/yazi, and runs the triggers its paths call for.
Contents
Installed programs: ya, yazi.
Installed directories: /usr/share/licenses/yazi.
Notes
The crates are vendored: ports/fetch runs cargo vendor over the source and packs the result into yazi-vendor-<version>.tar.xz, pinned by its sha256 in kpkgbuild, and the build runs --frozen --offline (see Vendoring).
The readelf line stops the build unless yazi links libonig.so.5 from the oniguruma port. The onig_sys crate compiles its own copy of oniguruma, with no message, unless RUSTONIG_SYSTEM_LIBONIG is set, which the tree’s build environment exports from 40_lang on (see rust); the check catches the private copy if that export is ever lost.
The previews are other programs, which is why depends names them: yazi runs file for MIME types, ffmpeg for video, pdftoppm from poppler for PDF, resvg for SVG, ImageMagick’s magick for other images, jq for JSON, fd, rg, fzf and zoxide for search and jumping, 7zz from 7zip for archives and disk images, and chafa where the terminal has no image protocol. A missing one is a blank preview, not an error.
The desktop entry is Terminal=true, so the launcher opens yazi in the session’s terminal, Konsole, which speaks sixel and the kitty graphics protocol.