Getting around no-symlink policy


I managed to set up nix on my macos with an external-drive symlink to /nix. Everything seems to work up to some point. When I ran nix-shell on some project I’m working on, it started to download packages and build something, but after some time it failed with

"Bundling (...)"
warning: unknown setting 'allow-symlinked-store'
warning: unknown setting 'experimental-features'
warning: unknown setting 'extra-experimental-features'
error: the path '/nix' is a symlink; this is not allowed for the Nix store and its parent directories
rewrite-libs: ProcFailed {procCommand = "nix-store", procArguments = ["-r","/nix/store/i0zac1vw0ra6g2mg701m3kc9xbi24lgg-zlib-1.2.11/lib/libz.dylib"], procExitCode = ExitFailure 1}
error: builder for (...) failed with exit code 1
error: build of (...) failed

Neither export NIX_IGNORE_SYMLINK_STORE=1 nor setting up allow-symlinked-store = true in nix.conf seem to work (the latter seems to be unknown although mentioned by official docs).

Does anyone know a solution to this?

Seems to be an old nix, version 2.3 or older.

mateusz@Mateuszs-MacBook-Pro ~ % nix --version
nix (Nix) 2.9.1

Installed today from official bindist.

That nix was not what spit out those log messages, that was one thats 2.3 or older.

More is hard to say without knowing anything about your expression.

I’m running nix-shell inside of GitHub - input-output-hk/plutus-apps: The Plutus application platform. It seems that the nix-2.3.16 is indeed installed in the process. You’re saying that it gets invoked sometime during evaluation? How to trace which component depends on that old version?

Mount the drive to /nix rather than sylinking. That’s how a regular Nix installation looks like since Catalina, just with an APFS Volume rather than a separate drive.

I’ll try that, thanks a lot!

Hosted by Flying Circus.