我正在尝试关注此 tutorial , 以便在我的主目录中安装 Nix 包管理器而不是 /nix
.
我在做 PRoot 安装(参见教程中的 2.)。最后,该
教程建议在构建 native 包部分变得聪明,要
能够在没有 PRoot 的情况下运行包:
To run packages natively (without PRoot) they have to be build from source because all paths to the nix store are hard-coded. It is simple, really:
mkdir $HOME/nix
nix-channel --update
env NIX_STORE_DIR=$HOME/nix nix-env -i nix
And now your Nix store gets built up using the new paths. The built binaries can be run directly from there.
我这样做了,但我不明白它是如何让我摆脱 PRoot 的。如果我不做
/nix
带有 PRoot 的挂载点,没有任何作用(没有 nix-env
可执行文件,我无法安装新软件包)。
这应该
NIX_STORE_DIR
环境变量放在我的 .bashrc
?似乎我总是需要运行 PRoot 因为
~/.nix-profile
指着/nix/...
目录:.nix-profile -> /nix/var/nix/profiles/default
教程中有更多步骤 (5., 6.) - 我应该遵循它们吗?似乎它们仅适用于使用手动安装的情况(第 4 步),虽然不明确。
任何帮助,将不胜感激 :)
最佳答案
对于任何在这个老问题上磕磕绊绊的人:如果没有 root
,目前没有支持安装 Nix 的方法。 .以上维基移至https://nixos.wiki/wiki/Nix_Installation_Guide .它很可能已经过时了。 PRoot
可以工作,但即便如此,以不同的路径重建整个商店也不是一个好主意,尤其是因为二进制缓存无济于事,您需要构建所有内容。
我建议在虚拟机或云服务器中尝试 Nix。
关于home-directory - 关于在主目录中安装的 Nix 教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38584529/