Files
home-manager/tests/modules/programs/ghostty/example-settings.nix
Austin Horstman 4ebe20f112 ghostty: source shell integration only when present
The integration snippets keyed off GHOSTTY_RESOURCES_DIR being set and
sourced the script unconditionally. Applications embedding GhosttyKit,
such as cmux, export GHOSTTY_RESOURCES_DIR pointing at a resource tree
that ships terminfo and themes but no shell-integration directory, so
every interactive shell started inside them failed with:

  no such file or directory: /Applications/cmux.app/Contents/Resources/ghostty/shell-integration/zsh/ghostty-integration

Test for the integration file itself instead of the variable.
2026-07-28 20:03:33 -05:00

33 lines
977 B
Nix

{ config, ... }:
{
programs.bash.enable = true;
programs.fish.enable = true;
programs.zsh.enable = true;
programs.ghostty = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = null; };
settings = {
theme = "catppuccin-mocha";
font-size = 10;
};
};
nmt.script = ''
servicePath=home-files/.config/systemd/user/app-com.mitchellh.ghostty.service
assertPathNotExists $servicePath
assertFileContent \
home-files/.config/ghostty/config \
${./example-config-expected}
assertFileContains home-files/.bashrc \
'"''${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash" ]]; then'
assertFileContains home-files/.config/fish/config.fish \
'test -r "$GHOSTTY_RESOURCES_DIR/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish"'
assertFileContains home-files/.zshrc \
'"$GHOSTTY_RESOURCES_DIR"/shell-integration/zsh/ghostty-integration ]]; then'
'';
}