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
This commit is contained in:
tnichols217 2024-06-10 05:08:39 -04:00
parent 2064348e55
commit ad2f4c786c

View file

@ -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"