# How to get a missing .drv file for a derivation from nixpkgs?

**URL:** https://discourse.nixos.org/t/how-to-get-a-missing-drv-file-for-a-derivation-from-nixpkgs/2300
**Category:** Help
**Created:** [March 4, 2019, 2:41am UTC](https://discourse.nixos.org/t/how-to-get-a-missing-drv-file-for-a-derivation-from-nixpkgs/2300 "2019-03-04T02:41:27Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![psychic](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/p/8491ac/32.png) [@psychic](https://discourse.nixos.org/u/psychic)
#### Post date: [March 4, 2019, 2:41am UTC](https://discourse.nixos.org/t/how-to-get-a-missing-drv-file-for-a-derivation-from-nixpkgs/2300/1 "2019-03-04T02:41:27Z")

</div>

I have a package that has some dependencies.

`nix-store -qR /nix/store/...`

One of the dependencies: `/nix/store/53wi068kjrqfr2j0hzcxhbw2xaa990jr-bash-4.4-p23`

Trying to get its derivation with: `nix-store --query --deriver /nix/store/53wi...`  
yields: `/nix/store/2amas84m6w99q8lazd9fww6zrkakv6f9-bash-4.4-p23.drv`

This derivation, however, does not exist on my computer.  
Despite having in the nix.conf option (which is on by default, but just in case) to keep derivation files.

So I thought of regetting this .drv file by calling `nix-instantiate` with the  
relevant nix-expression (I know it’s the correct expression because when I  
build it I get the correct output path), but I’m getting a DIFFERENT store  
path than the one with `nix-store --query --deriver`.

`/nix/store/zvy7mbpxqlplqpflqn5xk9szx25s4mhg-bash-4.4-p23.drv`

To summarise:

```auto
$ cat $(nix-store --query --deriver /nix/store/53wi068kjrqfr2j0hzcxhbw2xaa990jr-bash-4.4-p23)
cat: /nix/store/2amas84m6w99q8lazd9fww6zrkakv6f9-bash-4.4-p23.drv: No such file or directory

$ nix-build -E '(import <nixpkgs> {}).bash'
/nix/store/53wi068kjrqfr2j0hzcxhbw2xaa990jr-bash-4.4-p23

$ nix-instantiate -E '(import <nixpkgs> {}).bash'
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/zvy7mbpxqlplqpflqn5xk9szx25s4mhg-bash-4.4-p23.drv

```

The reason I stumbled upon this issue in the first place is that `vulnix` was  
crashing because it couldn’t find the .drv files for dependencies in the  
closure I was scanning.

Oddly enough this problem did not occur to me on a revision from unstable: `ce8c243699808355e0a550c7bdebf4ca94f0480d`  
But when upgrading to the most recent commit in stable-19.03 the problem surfaced: `07e2b59812de95deeedde95fb6ba22d581d12fbc`  
And this happens with multiple dependencies, not just with the one I used in  
the example.

1. What should my approach be to find the missing .drv file?
2. Why does this problem happen in the first place?
3. Why does `nix-instantiate` on the nix expression and `nix-store --query --deriver` on the build output, return different .drv files?

Thanks for the help!

---

_[View the full topic](https://discourse.nixos.org/t/how-to-get-a-missing-drv-file-for-a-derivation-from-nixpkgs/2300)._
