如何解决nix-shell错误“错误:创建目录'/ nix / var':权限被拒绝”?

时间:2020-03-24 19:46:09

标签: nix

尝试突然运行nix-shell时遇到了错误。它曾经可以正常工作,但后来我没有错,开始出现以下错误:

jon@jon-laptop ~/D/C/D/0/color-word-analyzer (master)> nix-shell
building '/nix/store/02szzrd1w7wqmnkh9is5qlx64m7r6f1z-cabal2nix-color-word-analyzer.drv'...
installing
error: creating directory '/nix/var': Permission denied
error: creating directory '/nix/var': Permission denied
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
** need a revision for VCS when the hash is given. skipping.
cabal2nix: user error (Failed to fetch source. Does this source exist? Source {sourceUrl = "/nix/store/fvka3nd7slnqgjvfkjg649v77y10lc89-color-word-analyzer", sourceRevision = "", sourceHash = Guess "", sourceCabalDir = ""})
builder for '/nix/store/02szzrd1w7wqmnkh9is5qlx64m7r6f1z-cabal2nix-color-word-analyzer.drv' failed with exit code 1
error: build of '/nix/store/02szzrd1w7wqmnkh9is5qlx64m7r6f1z-cabal2nix-color-word-analyzer.drv' failed

颜色词分析器是我正在开发的Haskell项目的名称。 is here的default.nix非常简单,所以我不明白为什么这会导致这些错误。

1 个答案:

答案 0 :(得分:1)

cabal2nix似乎正在沙箱中调用Nix命令。在您的NIX_PATH中的Nixpkgs版本中,这是不允许的,并且可能是错误地发生的。我能够用

构建项目
nix-build -I nixpkgs=channel:nixos-unstable

离题:递归nix调用will受结果纯度和密封性的限制。