From 8ec4dafe89c36fe118af9e3e2070899e1beea607 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 4 Oct 2023 00:07:05 +0200 Subject: [PATCH] home-manager: fix assignment to read-only variable Fixes #4519 --- home-manager/home-manager | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/home-manager/home-manager b/home-manager/home-manager index 513d2f88d..da4c673f4 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -155,6 +155,11 @@ function setHomeManagerNixPath() { # Sets some useful Home Manager related paths as global read-only variables. function setHomeManagerPathVariables() { + # If called twice then just exit early. + if [[ -v HM_DATA_HOME ]]; then + return + fi + declare -r globalNixStateDir="${NIX_STATE_DIR:-/nix/var/nix}" declare -r globalProfilesDir="$globalNixStateDir/profiles/per-user/$USER" declare -r globalGcrootsDir="$globalNixStateDir/gcroots/per-user/$USER"