home-manager/tests/modules/programs/yazi/nushell-integration-enabled.nix
eljamm 92a26bf6df
yazi: add shellWrapperName & rename wrappers to yy
The program shell wrappers have been renamed from `ya` to `yy`
following the introduction of the new CLI tool named `ya`.

With this in mind, the `shellWrapperName` option has been introduced
to provide users with more flexibility in choosing the name they're
most accustomed to (ra, lf, ...).

Co-authored-by: XYenon <register@xyenon.bid>

Co-authored-by: 三咲雅 · Misaki Masa <sxyazi@gmail.com>
2024-06-26 09:08:30 +02:00

34 lines
719 B
Nix

{ pkgs, config, ... }:
let
shellIntegration = ''
def --env yy [...args] {
let tmp = (mktemp -t "yazi-cwd.XXXXX")
yazi ...$args --cwd-file $tmp
let cwd = (open $tmp)
if $cwd != "" and $cwd != $env.PWD {
cd $cwd
}
rm -fp $tmp
}
'';
in {
programs.nushell.enable = true;
programs.yazi = {
enable = true;
enableNushellIntegration = true;
};
test.stubs.yazi = { };
nmt.script = let
configPath = if pkgs.stdenv.isDarwin && !config.xdg.enable then
"home-files/Library/Application Support/nushell/config.nu"
else
"home-files/.config/nushell/config.nu";
in ''
assertFileContains '${configPath}' '${shellIntegration}'
'';
}