2023-09-22 11:00:16 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
shellIntegration = ''
|
2023-12-15 23:07:57 +00:00
|
|
|
def --env ya [args?] {
|
2023-11-25 08:17:54 +00:00
|
|
|
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5)
|
2023-12-15 23:07:57 +00:00
|
|
|
yazi $args --cwd-file $tmp
|
2023-11-25 08:17:54 +00:00
|
|
|
let cwd = (open $tmp)
|
2023-09-22 11:00:16 +00:00
|
|
|
if $cwd != "" and $cwd != $env.PWD {
|
|
|
|
cd $cwd
|
|
|
|
}
|
|
|
|
rm -f $tmp
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
programs.nushell.enable = true;
|
|
|
|
|
|
|
|
programs.yazi = {
|
|
|
|
enable = true;
|
|
|
|
enableNushellIntegration = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
test.stubs.yazi = { };
|
|
|
|
|
|
|
|
nmt.script = let
|
|
|
|
configPath = if pkgs.stdenv.isDarwin then
|
|
|
|
"home-files/Library/Application Support/nushell/config.nu"
|
|
|
|
else
|
|
|
|
"home-files/.config/nushell/config.nu";
|
|
|
|
in ''
|
|
|
|
assertFileContains '${configPath}' '${shellIntegration}'
|
|
|
|
'';
|
|
|
|
}
|