From ce4cfdce2ceefb0fcee4d1eb9369f89261a2af70 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 27 Oct 2022 22:20:37 +0200 Subject: [PATCH] home-environment: make getVersion more robust (cherry picked from commit f67649307d4f81d8fbac68c19d1d1c564ab26dca) --- modules/home-environment.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index dfbcbdc6b..636681023 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -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)