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
Haskell shell completion #106591
Haskell shell completion #106591
Conversation
bashCompDir="$out/share/bash-completion/completions" | ||
zshCompDir="$out/share/zsh/vendor-completions" | ||
fishCompDir="$out/share/fish/vendor_completions.d" | ||
bashCompDir="''${!outputBin}/share/bash-completion/completions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does ${!outputBin}
do here? Is it more appropriate than ${out}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$outputBin
is "bin"
or "out"
.
${!x}
is a double lookup of x
, so ${!outputBin}
evaluates to either $bin
or $out
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, that I ask stupid questions here, but I am curious about that variable and the manual didn’t enlighten me.
I know what $out
does, but how would $bin
look like in which kind of derivations is ${outputBin} = $bin?
For my uninformed eyes the $bin/bin/... in this change looks like a potential bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify: My naive expectations would be that $bin = $out/bin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$bin
is just the bin
output store path e.g /nix/store/...-niv-1.0-bin
, $bin/bin
is the "FHS" bin directory inside the separate bin output /nix/store/...-niv-1.0-bin/bin
.
I'll also point out that the bin
output isn't limited to having only a bin
directory. It makes sense to have supporting files like this in the same output. A data
or share
output is not helpful because it's only used in conjunction with bin
, negating potential closure size benefits and doing so creates a risk of creating a reference cycle in the output, which is not allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rebase this on the haskell-updates
branch?
Also, is this related at all to NixOS/cabal2nix#474 by @zimbatm?
507c759
to
2325cd5
Compare
Done.
It has the same goal, but those packages don't use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, for the explanation. Code looksreasonable. Tests pass. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Thanks!
I'm not sure of the full backstory, but I think the idea is that if you put overrides directly into This used to be important when there were tools like |
@cdepillabout I had a discussion about that with peti last friday. It's exactly for the reason you say. We are brainstorming right now about redesigning the process (something which we really want to hear your opinion about, btw. we‘d like to schedule a meeting as soon as we get to it), one longterm goal might be to migrate all those overrides into nixpkgs and having tooling that can generate derivations will taking overrides defined in nixpkgs into account. |
That's probably the best option. We have been using that approached in the ruby packages and it has been working quite well. The biggest advantage is that the haskell packages can be fixed, without having to re-release cabal2nix. |
This sounds exactly like how I expected it to work. 👍 |
To be honest, I don't really have strong opinions either way. It seems like a lot of people just end up using
I agree that this does sound nice, but maybe another solution would be to add more people as maintainers for |
Motivation for this change
Make shell completion work for more haskell commands.
niv
andormolu
require the "support separate bin" commit. Otherwise, it doesn't work whenniv.bin
is used, which is howpkgs.niv
is defined (as opposed tohaskellPackages.niv
).Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)