【问题标题】:nix-env and nix-build not found after installation (debian buster)安装后找不到 nix-env 和 nix-build (debian buster)
【发布时间】:2019-01-08 07:46:49
【问题描述】:

按照说明安装后

curl https://nixos.org/nix/install | sh

并且未找到注销/登录、nix-env 和 nix-build。 我遇到了 debian 拉伸问题,现在遇到了 buster 问题。我究竟做错了什么?

【问题讨论】:

  • 你可以在运行后尝试:/bin/bash --login on ubuntu

标签: nix


【解决方案1】:

nix manual 指示执行

source ~/.nix-profile/etc/profile.d/nix.sh

但是执行后打印的指令说要做(我不记得确切)

./~/.nix-profile/etc/profile.d/nix.sh

同样的命令被插入~/.profile。问题的原因是.source 之间的差异(请参阅https://superuser.com/questions/46139/what-does-source-do)。该脚本正在环境中设置 $PATH 变量,并具有 source 所需的效果,但 . 没有效果(它在自己的 shell 中运行并在最后关闭它)。

治疗: 将.profile(或最好将其移至.bashrc)中的行更改为

if [ -e /home/xxx/.nix-profile/etc/profile.d/nix.sh ]; then source /home/xxx/.nix-profile/etc/profile.d/nix.sh; fi

xxx 是您的用户名),

【讨论】:

  • source.没有区别;它们是同一命令的同义词。
  • 但是./~/.... ~/... 之间有很大的不同;前者只是从当前工作目录开始的路径(可能无效,因为您可能在当前工作目录中没有名为~ 的目录)。
  • 我认为我的记忆力并不完美,我忽略了.~ 之间的空格。我上面引用的讨论清楚地说明了source. 之间的细微差别——它们在同一个命令上是同义词,但对环境有不同的影响。阅读讨论!
  • 您引用的讨论谈到了以. 开头的路径(导致执行脚本)与采购它(无论是. 还是source)。
【解决方案2】:

你需要添加推荐的脚本,https://nixos.org/nix/manual/#ch-env-variables

【讨论】:

  • 这是自动完成的(并且已经完成),问题是```和source之间的区别。自动插入的脚本使用.
猜你喜欢
  • 1970-01-01
  • 2019-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多