From ad2f4c786c1b6ecbd270c061d47b7b5b71399674 Mon Sep 17 00:00:00 2001 From: tnichols217 <62992267+tnichols217@users.noreply.github.com> Date: Mon, 10 Jun 2024 05:08:39 -0400 Subject: [PATCH] home-environment: Add force flake profile override Added a new option home.forceNixProfiles to force the usage of 'nix profile' and not 'nix-env' Fixes #4928 as nix profiles do not require the presence of .drvs --- modules/home-environment.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index d0d44472a..d28f8c45e 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -445,6 +445,10 @@ in ''; }; + home.forceNixProfiles = mkEnableOption '' + forcing home-manager to use `nix profile` instead of + `nix-env` for activating the environment.''; + home.enableNixpkgsReleaseCheck = mkOption { type = types.bool; default = true; @@ -597,7 +601,7 @@ in $DRY_RUN_CMD $oldNix profile install $1 } - if [[ -e ${cfg.profileDirectory}/manifest.json ]] ; then + if [[ ${if config.home.forceNixProfiles then "true" else "false"} = true || -e ${cfg.profileDirectory}/manifest.json ]] ; then INSTALL_CMD="nix profile install" INSTALL_CMD_ACTUAL="nixReplaceProfile" LIST_CMD="nix profile list"