Installing package using `nix profile`: error opening directory

Hello, I am new to nix. I have tried out nix-env for installing packages, however its CLI is limited and so I tried out nix profile instead. I know nix profile is unstable, but hopefully you can help me.

The problem is that I am trying to install a bunch of packages and for a lot of them I receive an error.
For instance for jq I recieve the following error when I run nix profile install nixpkgs#jq

error: opening directory '/nix/store/082wsrr0c2gi1h9f0f7sj9kpj283dpra-jq-1.6-doc': No such file or directory

I receive similar errors for many other packages, fzf for instance:

error: opening directory '/nix/store/pb837rkl12i96rdbbnqv86sfhm6w22yc-fzf-0.29.0-man': No such file or directory

I should mention that I did not previously have problems installing using nix-env, also for the above packages. With a completely clean installation of nix I successfully installed jq using nix-env.
Also, it seems that the common error is that it has to do with doc or man (also for other packages).

Things I have tried:

  • Searching for the error on github and other sites - no luck
  • Reinstalling nix completely and as the first thing running nix profile install nixpkgs#jq
  • Installing using the complete attr path nix profile install nixpkgs#legacyPackages.x86_64-linux.jq
  • Running nix store gc and/or nix-collect-garbage (I assume they do the same thing)
  • Running nix build nixpkgs#jq - this works!!
  • Running nix shell nixpkgs#jq - this works!!

My setup:

  • arch linux
  • nix version 2.7.0
  • single user installation of nix

I am also experiencing this while installing nix packages with act container. It maybe is a regression. I added this line to use nix-2.7.0pre20220203_bd383d1. This issue does not exist on nix-2.7.0pre20220203_bd383d1.

These packages have multiple outputs.

I also tried to install nixpkgs#sqlite with the same problem, it just fail on the debug output.

Theory: this happens when substituting. When the main build accidentally produces the other outputs, there is no error. Instead, if the primary “out” is substituted but “dev” is not, the logic in getBuiltPaths assumes it exists in the local store.

I know how to bypass this error until the devs fix it.

If you are installing sqlite with

nix profile install nixpkgs#sqlite

and getting an

error: opening directory '/nix/store/yjf3bbv33qgr4w2sa7shkd83znjmcfnz-sqlite-3.37.2-debug': No such file or directory

You just have to run first

nix profile install nixpkgs#sqlite.debug

and then again the first command will run successfully.

1 Like

nix store repair can also be used. like this:

$ nix store repair /nix/store/yjf3bbv33qgr4w2sa7shkd83znjmcfnz-sqlite-3.37.2-debug