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 --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager
$ nix-channel --update $ 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 3. Run the Home Manager installation command and create the first Home
Manager generation: Manager generation:

View file

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