home-environment: make getVersion more robust

This commit is contained in:
Robert Helgesson 2022-10-27 22:20:37 +02:00
parent d3f21617ac
commit f67649307d
No known key found for this signature in database
GPG Key ID: 36BDAA14C2797E89
1 changed files with 9 additions and 1 deletions

View File

@ -680,7 +680,15 @@ in
getVersion = pkgs.writeShellScript "get-hm-version" ''
set -euo pipefail
cd "${../.}" || exit 1
dir="${../.}"
# Apparently, dir is not always set to the Home Manager directory.
if [[ ! -d $dir ]]; then
echo ""
exit 0
fi
cd "$dir" || exit 1
# Get the base release and initialize an empty version suffix.
release=$(< .release)