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

Refactor command-not-found #24962

Merged
merged 1 commit into from Apr 18, 2017

Conversation

makefu
Copy link
Contributor

@makefu makefu commented Apr 16, 2017

Motivation for this change

as of right now command-not-found is not working because programs.sqlite is not populated inside the channels. I took this as a chance to customize the current command-not-found module.
With programs.command-not-found.enable the feature can be disabled if unneeded.

With programs.command-not-found.dbPath the path to the db can be specified explicitly in case no channels are in use.

Things done
  • Tested all options
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@makefu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @spwhitt and @edef1c to be potential reviewers.

@makefu makefu force-pushed the modules/command-not-found/refactor branch from 43f1b7f to 77d8cc0 Compare April 16, 2017 23:58
@makefu makefu changed the title [WIP] Refactor command-not-found Refactor command-not-found Apr 16, 2017
options.programs.command-not-found = {

enable = mkOption {
default = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would even argue to disable this at the moment, because the sqlite database is almost empty since 16.09:

16.03:

$ sqlite3 /nix/var/nix/profiles/per-user/joerg/channels/nixos/programs.sqlite "select count(*) from Programs;"
23209

16.09:

$ sqlite3 /nix/var/nix/profiles/per-user/joerg/channels/nixos/programs.sqlite "select count(*) from Programs;"
653

17.03:

$ sqlite3 /nix/var/nix/profiles/per-user/joerg/channels/nixos/programs.sqlite "select count(*) from Programs;"
343

@makefu
Copy link
Contributor Author

makefu commented Apr 17, 2017

@Mic92 i wanted to preserve the original behavior but you are right, with the current state it would be best to disable them by default.
If this is a consensus i can change the default and push to the PR

add option to disable command-not-found as well as option to define dbPath.
Disabling this may remove the perl dependency for bash/zsh prompts
@Mic92
Copy link
Member

Mic92 commented Apr 17, 2017

Anybody who want to fix command-not-found? Otherwise I am going to merge this. I would also mark the module as broken before in this case.

@copumpkin
Copy link
Member

copumpkin commented Apr 17, 2017

@edolstra did some work with nar listing files recently. I also had a separate proposal for fixing it inside nixpkgs, but we decided to follow the nar listing files instead. If that isn't working properly, we might consider reviving my other proposal, which I think is easier to maintain without special support from Nix/Hydra or assumptions about binary caches.

@makefu
Copy link
Contributor Author

makefu commented Apr 18, 2017

@copumpkin This PR only provides a way to enable and disable command-not-found hooks for both bash and zsh. Replacing the tool which does the lookup itself is trivial in the future. Also dbPath can be reused i guess because somehow the information about available programs will be cached in some kind of artifact.

I'd really like to see my PR being merged to avoid having to maintain a fork of nixpkgs with this commit cherry-picked on top for the rest of eternity ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants