【问题标题】:nix-shell error - mkdir: cannot create directory '/nix/store/...': Read-only file systemnix-shell 错误 - mkdir: 无法创建目录 '/nix/store/...': 只读文件系统
【发布时间】:2015-07-25 22:04:14
【问题描述】:

我正在使用nix-shell 来调试我的包。 配置脚本如下所示:

configurePhase = ''
  mkdir -p $out
  ...
'';

当通过nix-build运行时,这段代码是可以的,但是当使用nix-shell运行时,我在运行configurePhase时无法创建$out目录

mkdir: cannot create directory '/nix/store/...': Read-only file system

我明白为什么会这样,但是如何解决这个问题?

【问题讨论】:

    标签: nixos


    【解决方案1】:

    这是因为$out 指向以只读方式挂载的/nix/store/...

    作为Eelco Dolstra pointed,有两种方法可以解决这个问题:

    • 不要在configurePhase 中创建$out,而是在installPhase 中创建。

    • $out 设置为不同的值。

    您可以使用

    设置$out 变量
    nix-shell --command "export out=/tmp/foo; return"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-07
      • 2020-05-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-13
      • 1970-01-01
      相关资源
      最近更新 更多