2023-09-22 13:00:16 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
shellIntegration = ''
|
2023-12-16 00:07:57 +01:00
|
|
|
def --env ya [args?] {
|
2023-11-25 09:17:54 +01:00
|
|
|
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5)
|
2023-12-16 00:07:57 +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
|
|
|
|
}
|
|
|
|
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}'
|
|
|
|
'';
|
|
|
|
}
|