Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only warn about non-existent database if nix-locate fails #44

Conversation

lilyinstarlight
Copy link
Member

@lilyinstarlight lilyinstarlight commented Jan 4, 2023

When using a non-standard database location for nix-index (e.g. via the NixOS module in the github:Mic92/nix-index-database flake), comma warns that the database is non-existent even though it does exist and nix-locate works fine

This changes the logic so that it only checks if the database exists when the nix-locate command fails

The warning I receive without this patch
[I] lily@bina ~> , node
Warning: Nix-index database does not exist, try updating with `--update`.
Welcome to Node.js v18.12.1.
The output with this patch when nix-locate fails to find database
[I] lily@bina ~> , node
Warning: Nix-index database does not exist, try updating with `comma --update`.
nix-locate failed with: error: reading from the database at '/home/lily/.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/bennofs/nix-index.
caused by: No such file or directory (os error 2)
The output with this patch when nix-locate succeeds
[I] lily@bina ~> , node
Welcome to Node.js v18.12.1.
The output with this patch for an unknown binary
[I] lily@bina ~> , nonexistentbin
No executable `nonexistentbin` found in nix-index database.

When using a non-standard database location for nix-index (e.g. via the
NixOS modules in the github:Mic92/nix-index-database flake), comma warns
that the database is non-existent even though it does exist and
nix-locate works fine.

This changes the logic so that it only checks if the database exists
when the `nix-locate` command fails.
@Artturin
Copy link
Member

Thanks

@Artturin Artturin merged commit b99c713 into nix-community:master Jan 14, 2023
@lilyinstarlight lilyinstarlight deleted the fix/nonstandard-database-location branch January 15, 2023 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants