2024-04-14 06:58:16 +00:00
|
|
|
{ pkgs, config, ... }:
|
2023-09-22 11:00:16 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
shellIntegration = ''
|
2024-02-26 23:00:56 +00:00
|
|
|
def --env ya [...args] {
|
2024-01-03 19:18:53 +00:00
|
|
|
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
2024-02-26 23:00:56 +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
|
|
|
|
}
|
2024-02-26 23:00:56 +00:00
|
|
|
rm -fp $tmp
|
2023-09-22 11:00:16 +00:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
in {
|
|
|
|
programs.nushell.enable = true;
|
|
|
|
|
|
|
|
programs.yazi = {
|
|
|
|
enable = true;
|
|
|
|
enableNushellIntegration = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
test.stubs.yazi = { };
|
|
|
|
|
|
|
|
nmt.script = let
|
2024-04-14 06:58:16 +00:00
|
|
|
configPath = if pkgs.stdenv.isDarwin && !config.xdg.enable then
|
2023-09-22 11:00:16 +00:00
|
|
|
"home-files/Library/Application Support/nushell/config.nu"
|
|
|
|
else
|
|
|
|
"home-files/.config/nushell/config.nu";
|
|
|
|
in ''
|
|
|
|
assertFileContains '${configPath}' '${shellIntegration}'
|
|
|
|
'';
|
|
|
|
}
|