2023-09-22 13:00:16 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
shellIntegration = ''
|
2024-02-27 00:00:56 +01:00
|
|
|
def --env ya [...args] {
|
2024-01-03 20:18:53 +01:00
|
|
|
let tmp = (mktemp -t "yazi-cwd.XXXXX")
|
2024-02-27 00:00:56 +01:00
|
|
|
yazi ...$args --cwd-file $tmp
|
2023-11-25 09:17:54 +01:00
|
|
|
let cwd = (open $tmp)
|
2023-09-22 13:00:16 +02:00
|
|
|
if $cwd != "" and $cwd != $env.PWD {
|
|
|
|
cd $cwd
|
|
|
|
}
|
2024-02-27 00:00:56 +01:00
|
|
|
rm -fp $tmp
|
2023-09-22 13:00:16 +02:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
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}'
|
|
|
|
'';
|
|
|
|
}
|