nix-community / comma

Comma runs software without installing it. [maintainers=@Artturin,@burke,@DavHau]
1.12k stars 49 forks source link

Prebuilt index not found #42

Open MarkusLohmayer opened 1 year ago

MarkusLohmayer commented 1 year ago

I tried to setup comma together with the prebuilt index from https://github.com/Mic92/nix-index-database but I get Warning: Nix-index database does not exist.

I am on macOS and I have nix-index-database.hmModules.nix-index as a home-manager module, further I have programs.nix-index.enable = true; and finally I have comma in home.packages.

You can see the precise setup here:

Thanks!

eclairevoyant commented 9 months ago

Yep, seems to be broken for this use case. Maybe it has to do with the wrapper that it's using.

bestlem commented 8 months ago

It also failed for me but I imported via the darwin module

so nix-index-database.darwinModules.nix-index and comma installed system wide via environment.systemPackages

The command-not-found hook for nix-index does however work so the infrastructure is there.

lancelet commented 1 month ago

I have a similar setup, but was able to get around the problem by re-generating the index:

The error:

$ , cowsay neato
Warning: Nix-index database does not exist, either obtain a prebuilt database from https://github.com/Mic92/nix-index-database or try updating with `nix run 'nixpkgs#nix-index' --extra-experimental-features 'nix-command flakes'`.
nix-locate failed with: error: reading from the database at '/Users/jsm/.cache/nix-index/files' failed.
This may be caused by a corrupt or missing database, try (re)running `nix-index` to generate the database.
If the error persists please file a bug report at https://github.com/nix-community/nix-index.
caused by: No such file or directory (os error 2)

Workaround (doing what it suggests) - takes 10 minutes or so:

$ nix run 'nixpkgs#nix-index' --extra-experimental-features 'nix-command flakes'
+ querying available packages
+ generating index: 87498 paths found :: 42779 paths not in binary cache :: 00000 paths in queue
+ wrote index of 39,021,028 bytes

Then it works, but with a bunch of warnings about missing channels:

$ , cowsay neato
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
 _______
< neato >
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

I'm not sure about those warnings. Googling only says something about them not being relevant when flakes are used... (or something?)

I'm also concerned that the state it dumped in ~/.cache/nix-index/files requires a manual update, but that's less objectionable that the warnings.

SuperSandro2000 commented 1 month ago

I'm not sure about those warnings. Googling only says something about them not being relevant when flakes are used... (or something?)

Those are because you have the directory in NIX_PATH but it doesn't exist. It is a warning from nix and has nothing to do with comma.

I'm also concerned that the state it dumped in ~/.cache/nix-index/files requires a manual update, but that's less objectionable that the warnings.

Yes, that's why many people use the index-db via flakes.