home-manager/direnv: Workaround a lazygit bug

https://github.com/jesseduffield/lazygit/issues/5279
This commit is contained in:
Sridhar Ratnakumar 2026-03-04 15:34:21 -05:00
parent d858b1a3f0
commit 765ba2aae7

View file

@ -13,4 +13,23 @@
hide_env_diff = true;
};
};
# Avoid "warning: unhandled Platform key FamilyDisplayName" which crashes lazygit
# See: https://github.com/jesseduffield/lazygit/issues/5279
# We use a file in lib/ that sorts alphabetically after hm-nix-direnv.sh
# so that we can wrap its functions.
xdg.configFile."direnv/lib/zz-macos-fix.sh".text = ''
if [[ "$OSTYPE" == "darwin"* ]]; then
# Wrap use_flake
if declare -f use_flake >/dev/null; then
eval "$(declare -f use_flake | sed 's/^use_flake/original_use_flake/')"
use_flake() { original_use_flake "$@"; unset DEVELOPER_DIR; }
fi
# Wrap use_nix
if declare -f use_nix >/dev/null; then
eval "$(declare -f use_nix | sed 's/^use_nix/original_use_nix/')"
use_nix() { original_use_nix "$@"; unset DEVELOPER_DIR; }
fi
fi
'';
}