home-manager: Add home-manager search path to EXTRA_NIX_PATH (#3241)

This commit is contained in:
Zhaofeng Li 2023-01-10 02:35:00 -07:00 committed by GitHub
parent 950aace44e
commit 176e455371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View File

@ -58,16 +58,6 @@ and if you follow a Nixpkgs version 22.11 channel you can run
$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager
$ nix-channel --update
----
+
On non-NixOS, you may have to add
+
[source,bash]
export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH}
+
to your shell (see https://github.com/NixOS/nix/issues/2033[nix#2033]
and
https://discourse.nixos.org/t/where-is-nix-path-supposed-to-be-set/16434/8[this
reply on the Nix Discourse]).
3. Run the Home Manager installation command and create the first Home
Manager generation:

View File

@ -87,7 +87,7 @@ function setHomeManagerNixPath() {
"${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager" \
"$HOME/.nixpkgs/home-manager" ; do
if [[ -e "$path" || "$path" =~ ^https?:// ]] ; then
export NIX_PATH="home-manager=$path${NIX_PATH:+:}$NIX_PATH"
EXTRA_NIX_PATH+=("home-manager=$path")
return
fi
done
@ -130,7 +130,6 @@ function doInspectOption() {
exit 1
fi
setConfigFile
setHomeManagerNixPath
local extraArgs=("$@")
@ -170,7 +169,6 @@ function doInstantiate() {
exit 1
fi
setConfigFile
setHomeManagerNixPath
local extraArgs=()
@ -192,7 +190,6 @@ function doInstantiate() {
function doBuildAttr() {
setConfigFile
setHomeManagerNixPath
local extraArgs=("$@")
@ -602,6 +599,8 @@ COMMAND=""
COMMAND_ARGS=()
FLAKE_ARG=""
setHomeManagerNixPath
while [[ $# -gt 0 ]]; do
opt="$1"
shift