Skip to content

Calling nix-env -qa results in failure on not-yet-built project

While Mix to Nix is working well for building projects, I get an error while trying to use nix-env when a project has not been built yet.

We use nix-env to list all available derivations in our internal nix-overlay, so that we can make our CI server build each derivation in turn.

Now, if I create a dummy Elixir project using mix new, setup a default.nix according to the docs, and then call nix-env -f default.nix -qa --show-trace in that directory (without calling nix-build first), I get this:

error: while evaluating 'importElixir' at /nix/store/gz1a1xq552xg69r2iqsnk3hl4skdvslb-source/default.nix:240:18, called
 from /nix/store/gz1a1xq552xg69r2iqsnk3hl4skdvslb-source/default.nix:259:19:                                          
while evaluating 'importJSON' at /nix/store/nh38qpbmmrli8w3zqv00jv120chf1biz-nixos-18.09.1819.76aafbf4bf4/nixos/lib/tri
vial.nix:237:16, called from /nix/store/gz1a1xq552xg69r2iqsnk3hl4skdvslb-source/default.nix:240:24:                   
cannot read '/nix/store/yhhb0ih007drznbwd76h8khywbp8pyk1-elixir-term.json', since path '/nix/store/4jv30jsybmwlw9pjay3c
m2a15dxkj1ki-elixir-term.json.drv' is not valid, at /nix/store/nh38qpbmmrli8w3zqv00jv120chf1biz-nixos-18.09.1819.76aafb
f4bf4/nixos/lib/trivial.nix:238:24

It looks like some kind of bootstrapping problem to me, since the drv-path doesn't exist yet when we try to import it. I'm not fully understanding what to do about it, however. Any pointers? Thank you!

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information