Hi, I’ve been using nix for my development environment recently, and stumbled upon a strange behavior in nix that I can’t wrap my head around. My nix file is pretty complicated, but the problem I am facing can be reproduced with a simple nix expression on latest nixpkgs(unstable):
- This succeeds:
nix-build -E 'with import <nixpkgs>{}; nix'
- This fails:
nix-build -E 'with import <nixpkgs> {}; let unused = {whatever.extensions =[];}; in nix' --show-trace
Error:
error: assertion '(final).hasSharedLibraries' failed
at /nix/store/svn32a4sxwkcgq1nvfm7sgmsmvqql8my-nixpkgs/nixpkgs/lib/systems/default.nix:89:25:
88| extensions = rec {
89| sharedLibrary = assert final.hasSharedLibraries;
| ^
90| /**/ if final.isDarwin then ".dylib"
Note that changing “extensions” attr to any other name, solves the problem.
What I can’t understand is how can anything I declare inside my own nix file affect derivations in ? thanks.