1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-26 03:39:47 +01:00

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 committed by Mikilio
parent 6ea6f0fbbb
commit d5f201ca6c
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

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