1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 12:33:34 +02:00
home-manager/tests/modules/programs/yazi/nushell-integration-enabled.nix
XYenon 8f21edd1e4
yazi: fix nushell integration
(cherry picked from commit 992b38f29c)
2024-04-06 08:46:59 +02:00

38 lines
764 B
Nix

{ pkgs, ... }:
let
shellIntegration = ''
def --env ya [args?] {
let tmp = (mktemp -t "yazi-cwd.XXXXX")
if ($args == null) {
yazi --cwd-file $tmp
} else {
yazi $args --cwd-file $tmp
}
let cwd = (open $tmp)
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}'
'';
}