From fe1e2dee1955f130830536403c7564f4afc6edc0 Mon Sep 17 00:00:00 2001 From: midchildan Date: Fri, 14 Apr 2023 02:03:41 +0900 Subject: [PATCH] home-manager: make sure Nix profiles path exists The Nix profiles path may not exist right after installing Nix. In that case, it is created on demand by the Nix CLI tools. However, Home Manager assumes it exists and fails if it doesn't. This change makes sure to trigger the creation of the Nix profiles path before attempting to access it. --- modules/lib-bash/activation-init.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/lib-bash/activation-init.sh b/modules/lib-bash/activation-init.sh index 546495453..20e7a30ef 100644 --- a/modules/lib-bash/activation-init.sh +++ b/modules/lib-bash/activation-init.sh @@ -105,6 +105,9 @@ _i "Starting Home Manager activation" $VERBOSE_RUN _i "Sanity checking Nix" nix-build --expr '{}' --no-out-link +# Also make sure that the Nix profiles path is created. +nix-env -q > /dev/null 2>&1 + migrateProfile setupVars