Open roberth opened 3 years ago
I marked this as stale due to inactivity. → More info
stable bot: Still broken.
A solution is available https://github.com/NixOS/nix/pull/4452. If a maintainer agrees with the design, I'll happily rebase it. Otherwise, I can implement any suggestions.
I marked this as stale due to inactivity. → More info
A solution is available #4452. If a maintainer agrees with the design, I'll happily rebase it. Otherwise, I can implement any suggestions.
I marked this as stale due to inactivity. → More info
Not stale.
(I generally don't "unstale" issues, but I think I saw another Nix issue being closed by the Stale bot today, and I don't want that to happen.)
Sorry, complete nix noob here. Does this issue, and related PR, prevent the lack of _get_comp_words_by_ref, etc, in nix-shell shells?
With a shellHook in my shell.nix running
source <(kubectl completion bash)
when trying to complete kubectl commands beginning with c I get;
[nix-shell:~]$ kubectl cbash: _get_comp_words_by_ref: command not found
Although if I install bash-completion and then manually source /nix/store/....-bash-completion-2.11/etc/profile.d/bash_completion.sh inside the nix-shell I get an additional 72 functions declared, including _get_comp_words_by_ref, and bash completion for kubectl I made the shell load and all the other builtin-it/included completions (wget, etc) function perfectly.
[nix-shell:~]$ declare -F | grep _get
[nix-shell:~]$ source /nix/store/jm0zjy8chipraqchwprgs15ajp705cin-bash-completion-2.11/etc/profile.d/bash_completion.sh
[nix-shell:~]$ declare -F | grep _get
declare -f __get_cword_at_cursor_by_ref
declare -f _get_comp_words_by_ref
declare -f _get_cword
declare -f _get_first_arg
declare -f _get_pword
[nix-shell:~]$
Is your feature request related to a problem? Please describe.
nix-shell
doesn't currently provide bash completion for new commands that provide their own completion scripts. https://github.com/NixOS/nixpkgs/pull/103501 aims to change that, but can't support completions innix-shell -p
because that command adds to the wrong attribute,buildInputs
instead ofnativeBuildInputs
.Describe the solution you'd like
nix-shell
should setnativeBuildInputs
(one way or another).This aligns with having
strictDeps
by default (which is not a requirement though). StrictDeps enforces desirable properties like outputs not retaining references to build tools. It also prevents mistakes that break cross-compilation.We can pick from these designs or think of something better.
principled scheme
-p
sets both and emits a warning--tool
adds tonativeBuildInputs
--input
adds tobuildInputs
minimal scheme
-p
setsnativeBuildInputs
--input
adds tobuildInputs
With the minimal scheme we don't have to update all documentation to change
-p
s to--tool
s, but it will silently break somenix-shell
invocations.compatible scheme
Like the principled scheme but without the warning. Does nothing to help towards strictDeps.
Describe alternatives you've considered
Also add
buildInputs
toXDG_DATA_DIRS
, but this "non-strictDeps" behavior is risky, potentially affecting any build in Nixpkgs.Additional context