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

nixos/programs/bash: Let bash-completion lazy load scripts #32534

Merged
merged 2 commits into from Dec 10, 2017

Conversation

hedning
Copy link
Contributor

@hedning hedning commented Dec 10, 2017

As described in detail here: #32533
bash will load completion scripts in <nix-profiles>/share/bash-completion/completions/ on
startup instead of letting bash-completion do it's lazy loading. Bash startup
will then slow down (very noticeable when bash-completion is installed in a
profile, see #22648).

Motivation for this change

This commit leaves loading of scripts in the hands of bash-completion,
improving startup time for everyone using enableCompletion.

Things done

I've tested the changes making sure that completion scrips in
/run/current-system/sw/share/bash-completion/completions and ~/.nix-profile/share/bash-completion/completions is working correctly.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

As described in detail here: NixOS#32533
bash will load completion scripts in $p/share/bash-completion/completions/ on
startup instead of letting bash-completion do it's lazy loading. Bash startup
will then slow down (very noticeable when bash-completion is installed in a
profile).

This commit leaves loading of scripts in the hands of bash-completion,
improving startup time for everyone using `enableCompletion`.

fixes NixOS#32533
Copy link
Contributor

@orivej orivej left a comment

Choose a reason for hiding this comment

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

I have updated the comment.

@hedning
Copy link
Contributor Author

hedning commented Dec 10, 2017

Right, so the whole loop over $NIX_PROFILE can be removed really. Want me to add that?

@orivej
Copy link
Contributor

orivej commented Dec 10, 2017

I don't think the loop can be removed because this will disable obsolete completions installed into the user profile. (The system profile completions will be loaded from /etc/bash_completion.d/ regardless.)

@hedning
Copy link
Contributor Author

hedning commented Dec 10, 2017

Ah, yeah, true.

@orivej orivej merged commit 8168671 into NixOS:master Dec 10, 2017
@jeaye
Copy link
Contributor

jeaye commented Dec 10, 2017

Thank you!

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