gh: test for existence of hosts file

Having the module enabled but never using gh will result in the config file
existing but no hosts.yml. In that scenario we won't have anything to
migrate, so only test for hosts.yml.
This commit is contained in:
Harsh Shandilya 2023-12-27 15:02:56 +05:30
parent d1d950841d
commit 2939d49036

View file

@ -136,7 +136,7 @@ in {
# See https://github.com/nix-community/home-manager/issues/4744 for details. # See https://github.com/nix-community/home-manager/issues/4744 for details.
home.activation.migrateGhAccounts = home.activation.migrateGhAccounts =
hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] '' hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
if [[ -e "${config.xdg.configHome}/gh/config.yml" ]]; then if [[ -e "${config.xdg.configHome}/gh/hosts.yml" ]]; then
( (
TMP_DIR=$(mktemp -d) TMP_DIR=$(mktemp -d)
trap "rm --force --recursive $TMP_DIR" EXIT trap "rm --force --recursive $TMP_DIR" EXIT