我正在使用 nix-shell
调试我的包。
配置脚本如下所示:
configurePhase = ''
mkdir -p $out
...
'';
通过
nix-build
运行时, 这段代码没问题,但是当用 nix-shell
运行时我无法创建 $out
运行时的目录 configurePhase
mkdir: cannot create directory '/nix/store/...': Read-only file system
我明白为什么会发生这种情况,但如何解决这个问题?
最佳答案
这是因为 $out
指向 /nix/store/...
以只读方式安装。
如 Eelco Dolstra pointed ,至少有两种方法可以解决这个问题:
$out
在 configurePhase
,在 installPhase
中进行反而。 $out
到一些不同的值。 您可以设置
$out
变量与nix-shell --command "export out=/tmp/foo; return"
关于nixos - nix-shell 错误 - mkdir : cannot create directory '/nix/store/...' : Read-only file system,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31559303/