mirror of
https://github.com/nix-community/home-manager.git
synced 2026-11-07 14:59:33 +00:00
home-manager: remove deprecated configuration path fallbacks
Since 23.05, configurations in `$XDG_CONFIG_HOME/nixpkgs` or `~/.nixpkgs` have been found with a warning asking users to move them to `$XDG_CONFIG_HOME/home-manager`. Since 23.11, Home Manager source paths under those directories have only produced a warning. Remove both ahead of the 26.11 release; configuration and source paths passed explicitly still work. Update the manual, the `programs.home-manager.path` description, the shell completion default, and the help text, which still named the old locations.
This commit is contained in:
@@ -6,9 +6,9 @@ standard installation or `~/.config/home-manager/flake.nix` in a Nix
|
||||
flake based installation.
|
||||
|
||||
::: {.note}
|
||||
The default configuration used to be placed in `~/.config/nixpkgs`¸ so
|
||||
you may see references to that elsewhere. The old directory still works
|
||||
but Home Manager will print a warning message when used.
|
||||
The default configuration used to be placed in `~/.config/nixpkgs`, so
|
||||
you may see references to that elsewhere. Home Manager no longer looks
|
||||
for configurations there; move them to `~/.config/home-manager`.
|
||||
:::
|
||||
|
||||
This configuration file can be *built* and *activated*.
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
# Options
|
||||
#
|
||||
# -f FILE The home configuration file.
|
||||
# Default is '~/.config/nixpkgs/home.nix'.
|
||||
# Default is '~/.config/home-manager/home.nix'.
|
||||
# -A ATTRIBUTE Optional attribute that selects a configuration
|
||||
# expression in the configuration file.
|
||||
# -I PATH Add a path to the Nix expression search path.
|
||||
@@ -238,7 +238,7 @@ _home-manager_get-default-home-file ()
|
||||
{
|
||||
local HomeFileDefault
|
||||
|
||||
HomeFileDefault="$(_home-manager_xdg-get-config-home)/nixpkgs/home.nix"
|
||||
HomeFileDefault="$(_home-manager_xdg-get-config-home)/home-manager/home.nix"
|
||||
|
||||
echo "${HomeFileDefault}"
|
||||
}
|
||||
@@ -246,7 +246,7 @@ _home-manager_get-default-home-file ()
|
||||
# e.g.:
|
||||
#
|
||||
# $ _home-manager_get-default-home-file
|
||||
# ~/.config/nixpkgs/home.nix
|
||||
# ~/.config/home-manager/home.nix
|
||||
#
|
||||
|
||||
##################################################
|
||||
|
||||
@@ -75,22 +75,11 @@ function setConfigFile() {
|
||||
elif [[ ! -v HOME_MANAGER_CONFIG ]]; then
|
||||
local configHome="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
local hmConfigHome="$configHome/home-manager"
|
||||
local nixpkgsConfigHome="$configHome/nixpkgs"
|
||||
local defaultConfFile="$hmConfigHome/home.nix"
|
||||
local configFile
|
||||
|
||||
if [[ -e "$defaultConfFile" ]]; then
|
||||
configFile="$defaultConfFile"
|
||||
elif [[ -e "$nixpkgsConfigHome/home.nix" ]]; then
|
||||
configFile="$nixpkgsConfigHome/home.nix"
|
||||
# translators: The first '%s' specifier will be replaced by either
|
||||
# 'home.nix' or 'flake.nix'.
|
||||
_iWarn $'Keeping your Home Manager %s in %s is deprecated,\nplease move it to %s' \
|
||||
'home.nix' "$nixpkgsConfigHome" "$hmConfigHome" >&2
|
||||
elif [[ -e "$HOME/.nixpkgs/home.nix" ]]; then
|
||||
configFile="$HOME/.nixpkgs/home.nix"
|
||||
_iWarn $'Keeping your Home Manager %s in %s is deprecated,\nplease move it to %s' \
|
||||
'home.nix' "$HOME/.nixpkgs" "$hmConfigHome" >&2
|
||||
fi
|
||||
|
||||
if [[ -v configFile ]]; then
|
||||
@@ -114,33 +103,6 @@ function setHomeManagerNixPath() {
|
||||
_iWarn 'Home Manager not found at %s.' "$path"
|
||||
fi
|
||||
fi
|
||||
|
||||
for p in "${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager" \
|
||||
"$HOME/.nixpkgs/home-manager" ; do
|
||||
if [[ -e "$p" ]] ; then
|
||||
# translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
|
||||
_iWarn $'The fallback Home Manager path %s has been deprecated and a file/directory was found there.' \
|
||||
"$p"
|
||||
# translators: This message will be seen by very few users that likely are familiar with English. So feel free to leave this untranslated.
|
||||
_i $'To remove this warning, do one of the following.
|
||||
|
||||
1. Explicitly tell Home Manager to use the path, for example by adding
|
||||
|
||||
{ programs.home-manager.path = "%s"; }
|
||||
|
||||
to your configuration.
|
||||
|
||||
If you import Home Manager directly, you can use the `path` parameter
|
||||
|
||||
pkgs.callPackage /path/to/home-manager-package { path = "%s"; }
|
||||
|
||||
when calling the Home Manager package.
|
||||
|
||||
2. Remove the deprecated path.
|
||||
|
||||
$ rm -r "%s"' "$p" "$p" "$p"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Sets some useful Home Manager related paths as global read-only variables.
|
||||
@@ -180,16 +142,11 @@ function setFlakeAttribute() {
|
||||
if [[ -z $FLAKE_ARG && ! -v HOME_MANAGER_CONFIG ]]; then
|
||||
local configHome="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
local hmConfigHome="$configHome/home-manager"
|
||||
local nixpkgsConfigHome="$configHome/nixpkgs"
|
||||
|
||||
local configFlake
|
||||
|
||||
if [[ -e "$hmConfigHome/flake.nix" ]]; then
|
||||
configFlake="$hmConfigHome/flake.nix"
|
||||
elif [[ -e "$nixpkgsConfigHome/flake.nix" ]]; then
|
||||
configFlake="$nixpkgsConfigHome/flake.nix"
|
||||
_iWarn $'Keeping your Home Manager %s in %s is deprecated,\nplease move it to %s' \
|
||||
'flake.nix' "$nixpkgsConfigHome" "$hmConfigHome" >&2
|
||||
fi
|
||||
|
||||
if [[ -v configFlake ]]; then
|
||||
@@ -1064,7 +1021,7 @@ function doHelp() {
|
||||
echo "Options"
|
||||
echo
|
||||
echo " -f FILE The home configuration file."
|
||||
echo " Default is '~/.config/nixpkgs/home.nix'."
|
||||
echo " Default is '~/.config/home-manager/home.nix'."
|
||||
echo " -A ATTRIBUTE Optional attribute that selects a configuration"
|
||||
echo " expression in the configuration file."
|
||||
echo " -I PATH Add a path to the Nix expression search path."
|
||||
|
||||
@@ -19,10 +19,8 @@ in
|
||||
default = null;
|
||||
example = "$HOME/devel/home-manager";
|
||||
description = ''
|
||||
The default path to use for Home Manager. When
|
||||
`null`, then the {file}`home-manager`
|
||||
channel, {file}`$HOME/.config/nixpkgs/home-manager`, and
|
||||
{file}`$HOME/.nixpkgs/home-manager` will be attempted.
|
||||
The default path to use for Home Manager. When `null`, the
|
||||
{file}`home-manager` channel will be attempted.
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user