I'm using nix-shell to debug my package.
The configure script looks like this:
configurePhase = ''
mkdir -p $out
...
'';
When running via nix-build, this code is OK, but when running with nix-shell I cannot create $out directory when running configurePhase
mkdir: cannot create directory '/nix/store/...': Read-only file system
I understand why that happens, but how to fix this?
This happens because $out points to /nix/store/... which is mounted as readonly.
As Eelco Dolstra pointed, there are at leasy two ways to fix this:
Don't create $out in configurePhase, do it in installPhase instead.
Set $out to some different value.
You can set $out variable with
nix-shell --command "export out=/tmp/foo; return"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With